#multiplayer
1 messages ยท Page 667 of 1
yeah they are all using same character bp
so what can i do?
only rpc in gamestate?
In the editor, add the niagara component to your pawn, and set it to not auto-activate. Make sure to set the particle effect you want to use in it.
Place your input command on the Pawn rather than the player controller - this way you'll be on an actor that everyone knows about, and have an easy reference to where the actual effect should spawn.
If you want to prevent others from using it, then you should store a boolean in gamestate that you can turn off and on while running on server. The server should check if this value is on or off when someone attempts to activate it, and if off, then proceed to allow activating.
How you tell all the clients to activate it will need to vary based on your needs. You can multicast RPC it, but that means anyone that wasn't near the character that activated won't see the effect. You may want to use a replicated boolean (with the RepNotify option selected) or some other means of storing the state and when setting it the effect will be activated/deactivated on relevant clients.
Whether an RPC or through the OnRep function, when you want the effect to activate, grab the reference to the Niagara component and activate it (see screenshot).
that is a great idea
but the effect runs on a actor in the scene
so i can add the niagra effect to this actor
okay
but the niagra effect life time should be forever
so i can activate and disactivate it all time
i ticked this one
if iam near to the sever
as a client
i cant see the effect
but as the serrver i can
do i need to replicate the actor itself too
or just the effect @sinful tree
How hard would it be to have a game world that people play on a dedicated server and then have a level where they can build their home in that allows other players to join? So you would be able to go back and forth between connecting to the multiplayer server and disconnecting to go to your local home base but have it turn into their PC into a listen server for their friends to be able to go to their home?
The dedicated server stuff is easy, i have a back end API that puts you into the online game but im not sure how to handle the bounce back and forth and also making it so the game changes from client to client server for friends
Yes, the actor should be replicated
@sinful tree i did this but also other players can not see the effect
i did not do any multicast yet
but i thought the replicate would make it work
You either have to use the OnRep of a variable or a multicast I believe. Replicating the component doesn't appear to work on my end either.
can someone explain what do these 1 and * (asterisks) mean in this diagram from the network compendium?
Also, why does AGameMode::ReadyToStartMatch have a AGameMode::ReadyToStartMatch_Implementation() function?
Aren't _Implementation() functions only for RPCs?
You can read it as:
1 gamestate can contain many player state
1 playerstate contain 1 playercontroller
...
Can't recall what ReadyToStartMatch is, but _Implementation is user also for BlueprintNativeEvent and maybe other stuffs that I can't recall right now
Ohhh I see, that makes sense thanks! Is there a reason why there isn't a line from GameMode to PlayerController to show that many PlayerControllers can be referenced by a single GameMode? or that's not how it works?
ohh I didnt know, that makes sense now, thanks!
I think it was drawn like that because GameMode only exists in the Server, and it already references a GameState (that references many PlayerState that thus references PlayerController)
ohh I see, thanks again!
I'm changing the scale of a replicated actor on the server but it isn't being replicated to clients
how can test dedicated sever without packaging build
i have two levels first login to game play
Currently I have to create server build which time taking and slow
any suggestions ?
the scale is replicated together with the whole transform of the actor which is replicated only if you enable movement replication
if you are not planning to replicate movement then I would just replicate a separate variable with scale and react on changes of it client side
do you need to test seamless travel? Because if NOT you can just do that inside editor
who i can don it in editor
If you are asking how then just select "Play as client"
How can I get rid of this stuttering when playing as the client? https://gfycat.com/importanthilarioushairstreak
that would start current level on dedicated server
nah
yes
i want to from login which is not server level
i did it a years ago
in advance setting we have to tell the level to launch for server
Which movement component are you using?
did you tried to start editor in game mode from console command
done
client command PATH_TO_UE4Editor.exe PATH_TO.uproject -game -log
server command PATH_TO_UE4Editor.exe PATH_TO.uproject "PATH_TO_MAP.umap" -log -server
with commands like that you could start a client and a server separately without packaging
yes was looking for something like this
but you can set it these commands in editor
like uncheck single process and add name for server and play as standalone
it start server separate and client
this same what you are saying
thank you so much
none. It's a custom pawn.
Should I be using any? Sorry if i'm a bit clueless my first game from scratch and google wasn't helpful
So CharacterMovementComponent handles lag compensation for you
But any other movement component does not
Each actor has a replicated transform data, and a velocity, those values updated based on your net frequency via an OnRep
Between updates, especially if you are controlled pawn, there can be latency
And that latency can cause a jitter
should i just slap one of those into my airship? i didnt because i thought they came with their own controls and stuff
You should write a new from scratch
CharacterMovementComponent is not suitable for player-controlled ships imo
That requires C++ and a good knowledge about replication
There is a free course in learn.unrealengine.com about multiplayer, at the last section they cover how to make a replicated pawn movement component
You can use it as a reference, but dont do what they do, because it sucks
It would be a good starting point
then I can't
Is there anywhere I can download one?
I dont think so
You can download their implementation but it will not work alone
You wont get airship controls
You can start reading this chat
There are some key points for making a movement component there
I also shared the link of the course
Thank you
What should I be using to communicate to the server/host that a player died, and then to each player from there?
server should decide that player dies in the first place, from that point you can set some replicated bool to indicate that the player is currently dead
Is there a way to replicate animation blueprints? i got the movement down but both pawns follow the state machine of the client it would seem
once again, google didn't help me much, probably because i lack technical knowledge so idk what i'm exactly looking for
i already set the variable to repnotify and it didnt change anything
because it seems follows the client's poses (since they're two of the same class)
Like the other ship will always copy your ship's animations
even if the variable i'm using is set to repnotify
it's not affected, but it still looks shitty when all other ships are landed in the air because yours is landed
are there any tutorials for that?
i already got the transforms all down
i'm talking about animation blueprint
landing gear, wing orientation, all that
the bones
Hello everyone! I hope you guys have a nice day.
I'm having a problem with basic setup of multiplayer. The pawn is replicated but the client can't see the server's pawn and vice versa. I have two unmodified Player Starts and can confirm that the server uses the first one while the client uses the second one. What should I look into first?
I'll look into it. Thanks Lorash ๐
@twin juniper I am following this tutorial but the problem he's having isn't the same as mine
Hey guys, this time we will:
- replicate animations to clients and server
As always leave a comment if anything is unclear
Stay tuned on Facebook:
https://www.facebook.com/PyroDev/
Or stay tuned on Twitter:
https://twitter.com/PyroStudios
in his un-replicated version the animation just happens on the client not on the server
so when he crouches none of the other clients do
for me when i crouch all the other clients do even if they aren't crouching in their screens
and idk what to do
misuse in what sense? i've been trying things but i dont even know where to start ๐
:O
Unfortunately, watching this didn't solve my problem. ๐ฆ
I've tried line tracing from the center of the pawns to (0, 0, 0) and I can see the line trace of the other, but I still can't see the other pawn.
The pawn at the end of the red line is that of the server's
Here is the pawn's constructor:
i'm having problems with UpdateSession when trying to change session property's. the host correctly see the changes, but anyone searching for sessions does not see the new key(in fact the key is now empty, instead of what it originally was set with).
void UMultiplayerMenu::GameNameTextCommitted(const FText &Text, ETextCommit::Type CommitType) {
auto gInstance = GetGameInstance<UBrickBreakGameInstance>();
if (!gInstance->SessionInterface) return;
if (Text.ToString().Len()==0) return;
auto Ses = gInstance->SessionInterface->GetNamedSession(ActiveSession);
auto SessSet = gInstance->SessionInterface->GetSessionSettings(ActiveSession);
SessSet->Set(NameKey, Text.ToString());
bool bRes = gInstance->SessionInterface->UpdateSession(GameName, *SessSet, false);
UE_LOG(LogTemp, Log, TEXT("Changing name: %s - %d"), *Text.ToString(), bRes);
return;
}
this is how i'm setting the new NameKey which becomes blank to clients when searching for game's.
nvm, i forgot to set the advertisment flag on Set.
Guys how can I fix the rotation shake on the client when I rotate in find look
this is my blueprint
Having trouble changing a player's max acceleration, can someone help please?
"Acceleration" is a float curve
I want it so the faster you go, the less you can accelerate
Currently it seems like the server rollsback clients as if they are going too fast but the Max Walk speed limit is set really high (i go faster when playing standalone)
Hey guys, i think i got a simple question but I can't find a solution on google. ๐
When I open a level my Player Controller gets switched out for a new one. How can I retain data in variables over connects/disconnects?
Like I got a string variable for a access token for my API backend and I dont wanna loose that on server connect
Why is that event called SetMaxSpeed but it sets acceleration?
Also that will never work flawlessly in multiplayer. You need to do max speed changes through the move system in the CMC, and that needs c++
You store the value within your GameInstance.
That being said, you may not necessarily want your clients accessing your API directly, unless of course you're running listen servers then you don't really have a choice.
You're right i corrected it
Ok i really didnt know how to handle the problem thank you. But why couldn't i do what i did but change MaxWalkingSpeed in Blueprint?
The issue comes down to how the CMC is replicated. In Blueprint you can still do it, but you'll either have jerky movement due to the server correcting the position of the player, or, your player's speed won't increase until the server's replicated the new CMC value back to the client, making the speed increase input seem slightly lagged.
And in c++ it would be different? Can you maybe recommend a resource where i could learn more about that? I try to make a complexe movement system with varying max speeds, speed boosts, dash etc
And you'll be wanting to modify the CMC in C++ to do so if you're making a multiplayer game. This video, while a bit long, I think explains it very well and goes over both sprinting and a basic wall-running example. https://www.youtube.com/watch?v=RtQRMcupJs0
Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv
Join our community discord!
Discord: https://dis...
This looks like exactly what i need, thanks a lot kind sir
The one thing I think he doesn't do well in that video is how he simulates lag - you don't have to put it in the .ini - you can use a simple blueprint to do it:
ohh I read about the "game instance" but never guessed that it was a blueprint
i see i can set it in my project settings, so i should create a custom one?
Yep
ok thanks!
also don't worry about the API, it's ment to be called from the client
and that oauth2.0 access token has only read scopes ๐
so when I'm trying to message my controller to tell the relevant player that they got a kill or died, what can I do to select only those players? I can get a reference to the dead player because this function follows their death sequence
Thanks a lot this is precious advice for a newbie like me ๐
You can also do this when starting to play the game with the "Advanced settings", but that depends on if you want to have a toggle or not I guess ๐
It does have more options, but I assume those are also accessible through commands.
All the way down at the "Play" button:
I need help creating an event that fires whenever a player dies, to add score to the player who killed them. I'm not sure if I should use a multicast function after running the death function on the server or not
check shootergame
usually just update player state or game state on server and let it replicate to clients after
you can message player states from the server?
am I missing something about how player states work? I thought that there would only be 5, one for each client and then the two of the clients that are replicated by the server
or use the command console or in the editor preferences in the play tab
A copy of each playerstate exists on each client and server.
that's because it's replicated to all?
Correct - playerstate is replicated to everyone.
I'm trying to get a simple score UI working, and I'm noticing that the client I'm firing the event on and the server are both getting the event to update it, but they're both adding twice instead of once, and the other client does nothing
it might be because I'm using an onrep function for the score variable, actually
also, the variable seems to set itself back to 1 after getting the second kill, so I have no idea what I've done wrong at this point
Where does score live, GameState or PlayerState I'd assume?
playerstate
the two I've highlighted are my score updating twice per kill before being sent to the ui
should I not use on replicates for a score and just do a slow tick or something?
Repnotify is fine.
ok
You're not ALSo doing a multicast event as well right?
๐ณ
I'll try client-only
or norep I mean
same deal
the circled one runs immediately after checking health in onrep health
death sequence is only things like ragdoll and changing visibility for certain things
@elder sage it should be as simple as updating score on server side and using onrep or binding the widget
Start with binding, it is performant enough.
the issue seems to be that the variable is being updated twice, so I should run that only on the server, for the relevant player(s)?
with 3 clients on listen server mode: 3 on server 3 on each pure clent (2) = 9 total
It's probably updating on server then updating on client
ofc, always update replicated data on server only
@elder sage show how you're updating the score variable and then updating the UI
the score is the one called "kills" in that previous screenshot, and then I do this
the rest is just setting text in the widget, which I'm fairly sure I have right
picks text block based on team
I see what's happening -> The "Player Died" is executing on server which is calling the multicast event (which also executes on server). Since it's a multicast, it'll execute both on the server and will properly execute only on the character where the "Get Controller" is valid.
So the player is adding 1, as is the server.
so I should just put the score update on the previous event because that's server-only?
Yep
so now only kills from the host player update the score twice for all players
clients work correctly, server does not
Ideally, your flow should be something like:
ON SERVER:
<something> is dealing damage to <player character>
<player character> health - damage
if <player character> health <= 0 set dead state, add score to <playerstate who instigated the damage>
so I use event anydamage and then put my health reduction and health check in onrep health, is that not ideal?
Definitely not.
Your server should be setting values.
OnRep can be used to control what happens when those values are set - like updating UI
I thought this node was server only?
You said: "put my health reduction and health check in onrep health"
Which executes on all (or at least any relevant actors at the time)
so I should make a server-only event after that node, then?
so is that more like what I should do?
AnyDamage only executes on the server. Anything that follows after it will also execute on the server.
If you are setting a variable that has a RepNotify, and then doing additional calculations within the RepNotify you're doing it in the wrong place. The calculations should be taking place on the server and values set on the server. The RepNotify can then be used on clients to update their UI only - not changing values again.
I think that fixed it
I'll probably have more questions in a minute lol but thank you
so if I'm trying to determine and then set the color of each player based on their team, how should I configure that? I'm currently running into an issue where the server player and the local player change color, but no non-local clients do.
actually maybe I figured it out
nvm, needed to rpc the server to run the multicast
Don't use RPCs to replicate state. Use RepNotify variables.
If you have only two teams, then it can be as simple as a boolean being turned on or off, with the default off being one of the colors.
If you need more than that, then you'll need to use an integer or, an enumerator.
I'm already using an int
so you're saying that I shouldn't put this function on an rpc at all?
So when you set the int for the player (guessing on the playerstate) that OnRep is where you'd set the colors.
but the character isn't necessarily spawned at that time
I was running into racing issues doing it the way you said because players join teams before the character initializes
That shouldn't matter - if the playerstate is given a value, then you can read from the playerstate when the player is spawned.
so are you saying I should set my color and everything when teams update?
part of the point is I want to compare so that players that match the local player are blue
What I'm saying is, use a variable on playerstate to hold the state of the team they are on. Make it RepNotify, and if the player's team changes, you can update their color through the OnRep.
If the player's character isn't spawned yet, that's fine - when you spawn the character, then you read the playerstate for the team value and set the colors.
so I'd still create the dynamic material instance after the character begins play?
because I need a component object reference in order to set that material color, and that can't happen until the character exists
also, the color needs to be set for each character because that's not actually based on the team you're on; all that it should check is what team matches the local player's
Sure, but read the playerstate for the team value.
I guess I don't get what point I'm supposed to change here. I should start my event when the teams update instead of when the players start?
Whenever you are wanting to set the team value, set it on playerstate. In the OnRep of the team you can check to see if the players character exist and display the colors necessary. If they don't exist yet, that's fine - when they do (such as on the begin play), you can have them check the playerstate for their team value
I'll try that. How would I ensure that I'm comparing the local player's team variable to each character's though?
Get reference to the local player's controller/character so you can reference their playerstate and get their team value.
Is it just "get local player controller"?
Teams are assigned and the cast to the player happens right after, so the players aren't created by the time it tries to assign a color
so it actually only works for the local player, and not any other
actually, only non-server player can see theirs and no others
what would be a good place to call my autosave and associated funcs? I noticed ARPG template has it on GameInstance, but it's not intended for multiplayer. Maybe PlayerState would be proper one in this case?
That's because you're using this call here. You're referencing only a single player character and that'll always be the local one.
so how would I reference that?
from the game state?
I made this change to it and now doesn't change any player colors
Game mode doesn't exist on clients.
game state does though?
Yes
I'd have to go from the game state's array of player states to a controller or pawn for each one in order to cast to my character
Within playerstate, there's this variable. It contains the pawn that is controlled by the playerstate.
And you're still doing multicast RPCs. Don't do that for this.
Use replicated variables.
seems like it works now
Hello, I am new to video game development and I am creating a test online multiplayer, I have a problem and it is that I cannot replicate the sound of the server in all the clients, does anyone have any idea about this? thanks in advance. Sorry for my English
I know that the server needs to tell each client to play the sound on their own @vast yarrow
The idea is that you're receiving the replicated team variable from the playerstate's OnRep - that function is then called on all clients when the value changes. Within the OnRep function you can reference the Pawn Private and set the color on that Pawn Private based on the new value of the team variable - as we're running on client, it'll happen on the local client that received the OnRep notification, so that client will see the color change.
I just plugged the onrep straight into the color function and that function is also called on beginplay in a character
idk how you test join late in unreal but I don't see what issues would be caused
I'm torn between running my line trace on the server for an authoritative system or running them on the client for a more consistent feeling
Yes I try but I don't know how to do it
all that's relevant is what's highlighted
so basically, client asks server if it can fire, server instructs the client to fire, server tells everyone to play the sound
I did that but it didn't work for me.
I'll explain what I have done: first what I do is start an animation of an object on the server (as this has replica seen on the client) at a certain moment the object plays a sound, I created an event for that sound as you showed me in the image but it didn't work for me
you have to make sure you're running an event on the server from the client, and then multicasting it from the server
seems redundant but it's because the client can't tell everyone to do something
The event that starts the animation is in BeginPlay and with the "switch has authority" in authority. I don't know if it has something to do with it
is this a spawn animation or something?
switch has authority just means it checks if it's the server or host player who's playing the node, so it already only runs on the server
just make a multicast event that plays your sound
yeah so your client isn't being told to play the sound
how would that be?
you make a custom event and change its replication to "multicast" so that the server will tell that event to run on every instance of whatever the blueprint is
is the "getactorlocation" necessary? I didn't put it on and it sounds the same
that's because it's playing globally, maybe?
I don't know a lot about how sounds work, but you probably want it in world space so it is relatively realistic
have I made some logical error here? I assume that I can just compare the player's team to each player's from an array, but that is not working practically for clients, as the colors are switched
only the highlighted section should be relevant
this is what it branches into
actually, does replicating a character also replicate things like its dynamic material instance?
It actually only seems to work for players on the first team. I may have set something up incorrectly when assigning the material
I can even see the client's actors swap colors almost immediately after spawning
You shouldn't be looping through anything.
I've removed the loops recently and it's still doing the thing
so the players have their team number in the top right, only the client on the top left is seeing things how I intend
I take it your goal here is so that no matter what, your team mates always appear blue and enemies always appear red, right?
yeah
So on the OnRep and on the Begin Play of a character on the client only, you should check the playerstate of that character and get their team value.
The team value the decides whether or not that player should appear blue or red.
You compare it to the local player's player state and if they are == then the character you're checking should be blue.
I already have this one
What is that in? Your character?
yeah it's in the character
Then you have a problem already - you're checking only if it's locally controlled, which other characters will not be.
so what should I do instead?
So I also need to check that when the team variable reps?
What you should do is make a function on the character called SetTeamColor or something to that effect. You can put the HasAuthority check directly in it. The OnRep can try calling that function if the pawn is valid.
I've been putting the function in the player state. Should I not do that, then?
The character is the one with the color. The playerstate should just hold data about the player.
The OnRep on playerstate is a necesscity since that's where the variable lies, but that can be used to call the color change on the character.
The authority check is to see whether you're running something on server or on client.
Begin play fires on both Server and Client
yeah, but this is a listen server
so the player with authority is being ignored in this case
the colors are still not switching based on the team
this is how I'm checking, same as when the game mode assigns them teams
Sorry, I was working under the idea of dedicated server. I do believe for listen server you shouldn't use the authority checks.
so the green one is correct and the pink ones are not
it seems like the local players all know what team they're on, but just aren't applying their colors or collision channels correctly
is there some way to get the locally controlled player? or to check each to see if it's locally controlled? The issue must be that it's comparing the character's teams objectively (modulo 2), not subjectively (equal local team)
It's hard to do in a listen server... Normally on the client side you could potentially do "Get Player Controller 0" which would return your player controller, but with listen servers it doesn't always work that way.
I'd prefer dedicated but I think I heard you can't package for dedicated and just run it for whatever reason
despite the fact that Ark servers exist and the process is literally called "ShooterGame"
so why doesn't the player controller 0 work for listen servers? I assumed that the local player would always connect first
Because sometimes the listen server itself becomes player 1 rather than 0.
or something to that effect.
could I use the array of player states somehow?
like, run a for loop after a local control branch to see which one matches the local player's playerstate?
?
You know what - you are going to have to loop through each player anyway.... Lets say fringe case here... A player changes their team mid-game. You need to update the colors for all players for that client.
I mean if it's not that intensive to run I might just run this entire thing again lol
oh, that one just works
I used get player character here but I dunno if it's ok...
let me try my idea just in case
I accidentally created the blue man group, so I'll give yours a shot
yeah I did that by adding the thing I showed, minus the local check at the beginning
you may want to go to the hud and print your team variable so you can reference that
just because I couldn't figure out which one was which initially
so client 1 is the only one who has it right, in this case
what's your team picker look like?
I just did a page up and page down to set the team
mine's based on join order but is consistent so that's not the issue
then your notify runs the function, probably
I only get the player character then cast, could that be it?
each player has their own team variable, so why would you need to get each player each time those variables update?
Because if your team changes, you need to refresh all the character's colors.
true
SO you may as well do it all at the same time regardless.
In the description of AGameStateBase::PlayerArray it says:
"Array of all PlayerStates, maintained on both server and clients (PlayerStates are always relevant)'
What does it mean for these player states to be "relevant"?
Is that a network term like "reliable" ?
Always Relevant means they will always exist on all clients. An example of something that may not necessarily be relevant is the character a player controls - if that character is very far away from your character, you probably don't need to receive updates for it, so it is no longer Relevant. The actor is then destroyed on the client, but still exists on the server. When you approach that actor again on the server, the server will see that you are close, and make that actor Relevant once again - the actor will spawn again automatically and it's begin play will fire again on the client.
UE4 primarily uses UDP communications which by nature are not reliable network packets as there is no confirmation sent back from the client to the server (or vice versa) when data is received. Using the reliable flag on an event I believe has something within the transmission that says something like "please confirm receipt" and if no receipt is received, it'll continue sending it periodically until a receipt is received.
You'd want to use the reliable flag for anything that is gameplay important.
If it's just a visual or sound effect that needs to play, it doesn't need to be reliable.
Oh I see, thanks for explaining! So basically, even if an enemy player's character/pawn gets destroyed from a client when it's too far to be relevant, their PlayerState would still be in that client and it would be accessed through GameState's PlayerArray on the client?
Correct
So you can still reference data about that player, just not necessarily the character they're controlling.
One thing that I dont understand though, how is it that the PlayerArray is replicated even though it doesn't have the Replicated or ReplicatedUsing UPROPERTY specifier?
It just has:
UPROPERTY(Transient, BlueprintReadOnly, Category=GameState)
TArray<APlayerState*> PlayerArray;
according to the comment description it's "maintained on both server and clients"
PlayerArray isn't replicated. The contents are.
so I want to make my line traces pass through teammates, any ideas for how to set the collision channels on those?
So you're saying that what gets replicated are the APlayerStates it points to but not the array itself?
So what if a PlayerState gets removed or added to the PlayerArray? Doesnt't it need to replicated that addition/removal?
From exi's network compendium
Oh I see, that makes sense now, thanks!
say I want to package my game and play with a friend, I'd obviously need to set up the ui to connect to the nodes, but do I use these "create session," "find sessions," and "join session," nodes, or do I need to do something different?
I have a handle on UI stuff and loading maps, but have no idea what goes into online play
Session stuff would be #online-subsystems .
Generally speaking if you don't have a subsystem like steam to allow for sessions to be registered online then you can only connect directly via IP anyway
@elder sage
that would probably be what I'd go with then, thanks
this actor is set to be invisible to the owner, but the owner still sees it. any idea what's up with that?
I've even tried setting the owner or setting the actor invisible manually and nothing happens
Hello everyone,
any advice on making the smoothest "elevator" platform in MP?
just some pointers if possible please so that I try and avoid physics issues and sync issues
I can't seem to make a floating health bar be hidden for the owner of it, and it's likely because I'm not sure how to set its ownership
what I've tried so far
please ping me if you have an answer
@elder sage No 100% answer, but Replicated Actors should only be spawned on the Server.
And the Owner should only be set on the Server too
And usually it must be a ClientOwned Actor, preferrably the PlayerController.
anyone knows how old value is saved for OnRep_(pre) ?
does it use copy constructor or serialize/deserialize ?
It's just a copy
Guys, quick question. I have an actor component which is attached to my Character. If my actor attempts to call a function, which is supposed to be executed on a server, it'll fail, because only Actor the-owner can call RPCs, right?
Correct
In that instance only the player controlling/owning the character could call that RPC
is there any virtual function in AActor to serialize some custom network data ?
I don't want to use UPROPERTY for my always changing properties.
No, but you could wrap it in USTRUCT, then define a custom NetSerialize() function for that struct
But you lose per-property serialization, it sends whatever you write which usually means all of it
(the properties that is not the actor)
@severe axle no, anything ultimately owned by the PlayerController on client can RPC
that includes PC, Pawn, PlayerState, any Actors that have had SetOwner called with any of them as a parameter, and any components on any of those Actors
if the RPC fails due to ownership, you'll have "No owning connection for..." warning in your Output Log
Actor also needs to be replicated to send a RPC - you can't RPC from something you spawned client side, or something that is not replicated
Pardon me asking again :p
any advice on making the smoothest "elevator" platform in MP?
just some pointers if possible please so that I try and avoid physics issues and sync issues
What exactly does join session do? As far as i can tell its basically only useful for getting the travelurl, and doesnt notify the host that it wants to join(i'm only looking at the null implementation though).
Join session actually puts you into the online session, i.e. so the online backend your using knows what session you are in
once joined successfully, you can travel. the null implementation doesn't have any online backend service
ok, so that's why i'm confused about it's implementation.
how do you normally get a reference to the GameState from a server? Through GetWorld() ?
so i think i finally got custom movement stuff working with the 4.26 changes to CMC. When i do p.netshowcorrections 1 I am seeing some capsules appear, but they're pretty sporadic, most of them are green or yellow with the occasional red. I have 200ms, 5% packet drop, and a couple other stats bumped up to simulate bad lag conditions. With these settings is it normal to see net corrections, or should I still be aiming for never seeing those?
Hello, I have a question, how can it be done so that a player who is in an area does not die and if he is outside, yes? I tried an triggerbox, but when one player was inside, the others didn't die either. Sorry for my English
I don't know what is the correct way to do it, what I do is that when it is in that triggerbox the character variable is false (so it doesn't die) but it seems to change them all.
Yes
I have an event that turns the player into a ragdoll and "dead" appears on the screen.
yes
It is a race that from time to time if you do not meet certain conditions (such as staying still) you die, when you reach the end I want it to not matter that you do not meet the conditions, that you move freely without anything happening to you
When I don't have to move and I move, the event fires correctly
I just need to deactivate it for the player who reached the end
I was able to get the triggerbox to detect me, but I don't know how to disable the event for that player only.
yes
That's probably my issue, then. If I want this to fire when my character spawns, should I just put an rpc in my begin play?
It seems like the issues I keep finding myself with is one where I accidentally spawn too many UI elements or actors that overlap, and I assume that I'm unable to affect them, while in reality I've just stacked multiple and only changed one
I spawned a health bar from my "draw Hud" event a while back and assumed that I wasn't able to reference the actor properly
hello guys, i have an rpg like project with many features already built without multiplayer in mind
it mostly uses multicast delegates for funcionalities, not much function calling outside of the events, from you experience, is it tough to convert an already big project to multi?
๐ฅฒ
do you think its smarter to start from scratch?
even if its already a big project
for sure
i guess i will have to go through the code and see how much it can actually be reused
thanks
I'm having trouble getting a reference from clients to a health bar actor I've made. I'm not sure how to set a reference to it so that each client will be able to access it when they take damage. I previously had this working but had to change the actor spawning to be on the server
this reference is no longer valid because the clients can't access it when it's set
it's a separate actor though, just attached to the player
I actually resolved the first issue by replicating the actor
Do I need to call "destroy actor" on the server too? When the player respawns the health bar is not removed and another one is created and attached
hey guys, I am doing replication so when my character picks up an item it disappears for everyone, but when he drops it, only the character that dropped it can see it, no one else can... any ideas how to fix that?
is the item an actor? If yes, does the actor get created when it's dropped? If yes, is the actor created by a server rpc?
this is the issue
Is the issue with ownership, maybe?
I'm still having the issue with the health bars not disappearing
I'm making progress, but it seems like ownership isn't being set correctly. The local player can still see their own health bar
Is there a particular reason you're using actors attached to your characters rather than using a widget component?
yeah it's so that I can set their visibility when they're obstructed
and other minor issues caused by that not working basically
my end goal is to make it so that these health bars aren't visible behind walls, but I'm apparently running into issues with ownership, so owner no see also doesn't work
I'm just gonna go back to the health bar component and figure out a different way of doing this
Okay, so what I'm trying to get working currently is I want the component to get hidden whenever its line of sight is blocked, like by a wall or object. I had it partially working, where when any player was obstructed, it would set itself to invisible for all players, but then it would start to flicker rapidly, and I do not know why
what if I perform a line trace from each health bar to the local player, and if it's obstructed, I set the property on either a custom material or the opacity of the widget itself?
I just did it 
how do I create a lazy tick so I don't cast multiple times per frame?
Does anyone know if you still need advanced sessions to host a game as listen serv on steam?
if you mean without C++ then that's probably likely unless there are comparable plugins that can register/join the session for you
Thanks, man. Appreciate it
GameSessionClass = APGGameSession::StaticClass();
The GameMode defines the GameSessionClass to be used.
That's what I try to do, but when I change the variable to true, it changes it on all players.
Does anyone know how to change the value of a variable in one player and not all?
Anyone remember on top of their head if PushModel system was able to differ changed and unchanged data when sending replication?
Change the variable on the specific character / playerstate of the player you're wanting to change it on.
I am new to unreal engine, I am going to investigate about the player state, thanks
You can run the server configuration directly from Visual Studio. Set your breakpoints and launch it.
I would think so, but I've never used Rider.
Development Server configuration is what it's called, the default editor is called Development Editor I think.
How are you launching the Dedicated Server then?
If you're running it via cmdline to ue4editor.exe then you can add those same commands to the debug launch parameters in Vs/rider.
To build Dedicated server you need to build engine from source.
So question here
after I made sure my game works in multiplayer in the editor by testing with a fake server in standalone mode
and i package my game out
how do I host an actual server so my friends can connect to it and we can test it together?
Yeah, so the PIE workflow is not the same as building Server configuration, or making a Server package I'm afraid. For instance I don't think RegisterServer is called.
FWIW it's not a requirement to call CreateSession() from RegisterServer either - for example at the moment we use GameMode::Tick() to register it after certain criteria are valid.
But if you want to run Dedicated server on another machine at any point you're going to have to figure out how to build Server config.
You'll need someone who knows about Rider to answer that for you.
oh... that's odd.
did you build a Server package from the Editor?
do that then ๐ that cooks the data that the Server exe needs to run (and also builds the latest server exe)
no need
Yeah it will the first time. Engine has to be recompiled to exclude non-server data.
nothing ๐
lots of RAM and lots of Cores is the best you can do
Threadripper + 128GB ram would help no doubt
Mine is only a 3950x with 64gb ram works fine.
Building the Engine is never fun. For a single dev it's probably pain, unless you have enough money to spend. We opted into using more reasonable CPUs for the dev machines and just beefing up a build machine that does the work for us.
But yeah, only an option if you work with multiple people, otherwise it makes little sense to buy a second pc for building :D
Yeah we have a threadripper build machine
yes
I would recommend learning about the Project Launcher a bit, as it allows for having more control over how the games are build, cooked and packaged.
Can reduce iteration time by a lot
My build machine is a fanless i7 under my stairs. Seriously underpowered for building engine, but as we use Install build workflow it only has to happen every time we upgrade the engine. Takes about 12 hours to build the installed engine with everything we need.
You don't - you forget and relearn when you need to ๐
We don't. We google and find our own answers on AnswerHUB every 2 Months.
๐ฆ
Hi, I have created a wall run for my game. This works fine when solo. In multiplayer I cannot figure out how to replicate the wall run correctly. There is a jitter when wall running on the client side and I'm not sure how to sort this.
Anyone knows what is WithNetSharedSerialization? Why it is useful?
its created with blueprints @twin juniper
can we sync data of two dedicate servers ?
or any related info link will be appreciated
It means that the type only has to be serialized once for each connection, i.e. it doesn't contain any connection-specific data such as FName's or UObject references.
never heard of something like that. What would be the use case for that?
For MMO games, there may be dozens of map levels. Thousands of players are on different maps. The architecture of UE4 is that each map needs to start a dedicated server separately. When players go from map A to map B, they will disconnect from the dedicated server for map A and establish a connection with the dedicated server for map B. Because...
something like this @empty axle
its use case in MMO
if i need 300 or more players info
UE is not designed for MMO. You need to carve your own tools for that.
for now have to go with this
may in next phase
but now need find some solution in UE
already write down most of the things
what exactly you want to send to the other server? Data about your players should be already in the database so the second server could just query it for it
then you don't need that server to server communication
one client can connect to two servers of UE of same level ?
i don't think
need send all servers info to master and the get from there
I didn't said that you have to connect to two servers at once
Every server in your case is a separate level ?
and you want to sync the data when travelling from one to other?
level is same and they should be able to spectate all players in between two or three servers
@empty axle
ohh, so there is definitely nothing built-in
MMO's pretty much always need their own bespoke architecture
Not something you can realistically build without a lot of expertise
Not to discourage, but best to set a realistic expectation
Not something you can realistically build without a lot of ~
expertise~ millions of dollars in marketing
i tested POC with 150 players
its working with UE4 solution with out doing any thing extra
but out requirements is about 600 players in single event
but for now in first phase 200
The only thing I know of that even comes close to what you want is SpatialOS - and it's taken them many years and many millions to get where they are. Not sure any game has shipped with it yet either.
Didn't Epic already had 'trouble' running 100 players for Fortnite? Also why not just use multiple servers, it can definitely be done though.. I know The Division 2 runs or ran 1000 players on 1 server but those are companies with a big budget and loads of people who know what they are doing with according to them people dedicated to optimising their servers ๐
They aren't running UE4, but that aside.
The answer is as always "it depends" - 100 players is a huge challenge for an FPS/TPS that has to remain responsive. Much less of a problem if it's a 100 player turn-based card game.
I suspect Division 2 has it's own funky architecture, but IIRC it also famously launched with a lot of client-side code that made it very easy to hack and cheat in. Not sure if offloading responsibility to clients instead of server to support player numbers was the motivation for that.
Or was that Div 1.. can't remember now
It doesn't scale linearly with number of players either usually.
But yeah.. Epic did a lot of groundwork to get the engine up to/beyond 100 players more easily.
In this 2020 GDC Virtual Talk, Ubisoft's David Lind presents the technical challenges and solutions in the area of game server performance on Tom Clancy's The Division 2, with a focus on parallelization and multithreading.
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC t...
It's an extremely boring talk if you're not interested in programming, but they explain a lot of problems they encountered and also go really deep into it. They also explain their architecture while doing so, they used a ton of parallel threading / multithreading to get it to run along with a ton of other stuff. They have if I remember correctly worlds for every player and run those all in parallel next to each other to tick them.
Though again, 1000 players on the same server is a matter for about 100 games on PC
Division 2 has 1000 players? I don't play it, but aren't most videos show only one or few players max? How 1000 players?
I believe they have a lot of worlds per server, not necessarily all players together in one world. But donโt quote me on that ๐
Uh basically like Destiny 2? Only few players max. That's no longer considered as 1000 players.
Only BR games usually has 100 players
I have not played Destiny, sorry.
Same
Destiny has a hard limit of 16 IIRC
I only saw Destiny in youtube video
D2 has 3, 6 or 12 players in activities
Nothing would prevent you from doing Destiny with Unreal Engine, other than their ability to have 60fps menus while loading levels
As long as it is not some 100 players BR or 1000 players, i think it should be fine.
How to properly rotate AI controlled characters in mp?
- Shooter game has
bUseControllerRotationYawon characters and custom FaceRotation. CMC options are off but leading to moonwalk - Guides suggest turning off
bUseControllerRotationYawand use CMC options "face movement direction" walking is fine but targeting is broken
Guess via the control rotation?
so 1?
๐
so far i did made it like shooter game, the only problem is that they moonwalk (always face focus direction)
during AIMoveTo orders
it works perfectly on clients
except that one thing
Should use properties not RPC's to move pieces
Location of a piece is a property not an event
I don't agree, events are way better in my case due to some future features.
Do you know why this might not work tho?
How do i change the ip of a dedicated server?
0.0.0.0 is just the broadcast IP, are you only wanting it accessible over a specific network interface?
You're making chess, you don't need local and server versions of moves. Just do it like this.
RPC move to server
Server does move
State replicates back
If by future features you mean replays, the server still has a list of all moves in order
@lost inlet Well yes i think basically i have the server runing on a different machine and de client in an other, wen i try to connect to the server nothing happens aka the clinet cant conect to the server. So i was told to change the ip address of the server
well if it's broadcasting over every network interface, I'm not sure how you think changing that will change your fortune
So any idea why i cant connect to the server?
Before I go into testing this - does anybody know if PostReplicateChange is called on an FFastArraySerializer, if an unmapped UObject within it is mapped?
RepNotifies are called when objects are mapped, but I'm unsure if that internal function is called.
Massive pain to setup a test for it so wondering if anybody knows definitively
Well I have no idea about your setup, is it behind a NAT?
Ok according to UDN PostReplicateChange is called when an object is mapped. Good stuff
Yes and the ports are open
is there some sort of known engine bug for rep notify and the float value 0.0f
it seems like only sometimes the rep notify will fire when the rep notify float is set to 0, but it will always fire if set to anything above 0.0
Seems to be working just fine on my end.
in c++?
you specify the server target when packaging your game. That's how you package the server in the first place.
Um... anybody ever experienced UWorld::NetMode returning 'Dedicated Server', but IsRunningDedicatedServer() returning false? Even weirder, anybody experienced the GameMode being present on a network client :/?
Oh ffs. They're static events. Of course.
Yet another stupid pull request merge
Static gameplay events in editor environments.. my fave
I've not packaged a server directly into debug mode but I don't understand why you wouldn't be able to. Maybe ask in #packaging
It's not.
Even COOLER. World subsystems are initialized before the worlds netmode is properly set.
Well what are you trying to do exactly?
You can do that. Just launch the dedicated server from VS directly. You can just pass in a custom configuration option and use development and it'll work like a charm.
Anyone know why my projectile collision (hit events) are inconsistent ?
I'm using the default settings (other than adjusted collision settings)
Is there a known issue with this ?
It's only when I shoot on full auto. It's about 0.05-0.08 seconds on a timer
Can anyone tell me why this isn't destroying the actor on the other clients? :S
if you are calling that from a client, then the caller might not be the owner of that actor, in which case it'd never reach the server
note the "(if owning client)" in the server rpc
you might need to route your rpc calls through the player controller or pawn or something the player owns
Alright thank you!
So as I go to override my Choose Player Start function in Game Mode, is there any easier way to check line of sight than doing a bunch of line traces?
I'd rather not spend time building something that already exists, basically, and I know nothing about player starts
i'm having issues with begin overlap events triggering when they shouldn't be. To explain exactly what's happening, I'm making a high paced soccer game, and sometimes the overlap events for the goals trigger when they shouldn't. Basically the ball gets kicked at the goal at high speed, and either the gk saves it and it flies another direction or it hits the posts/crossbar and bounces away, but it still triggers the overlap event
this is an example of it happening
i've nick named these ghost goals
when a client disconnects from the server, is there a function that is called? I see AGameStateBase::Logout but I don't know if that's the correct one
Is it a desync issue?
i don't think so. I did a switch has authority node on the custom events that fire from the overlap, so it should be only firing on the server
So if you record multiple perspectives, does it go into the goal on any of them?
no, from what i remember when it happens, people generally agree it shouldn't have been a goall
idk for sure tbh tho
in game mode base blueprint there is event on logout
i don't think it's an issue of the client firing it as far as i can tell. I have the actor blueprint class that has the overlap collisions not load on client and as i said, on overlap events I do switch has authority to make sure only the server fires it
So is the issue that the client is desynced, meaning that the ball actually does overlap the goal on the server's end?
You could also try putting your collision further back into the goal and see if that improves consistency
i don't know really i've been trying to figure it out for a while. The ball doesn't seem to be desynced for clients.
this is a workaround I might end up going with, but what I think might happen with this, is some goals won't count when they should. might be a better alternative than the problem i'm having now. would probably be less common
@spark owl you can ditch the overlap event completely
its easy enough to do the math if a point is inside a box by hand
and in this case, running that on Tick wouldn't really hurt
If I spawn an actor and replicate a variable that reference this actor, the variable might be null on the client because the variable was replicated, but not the actor it's pointing to.
Does the variable magically update its pointer when the actor is replicated?
Yes
OK great, is there a good strategy for catching this issue? Does a second OnRep_MyVariable() call happen so I can use that or do I need to create some kind of wait tick for both to be in sync?
I have a weapon that's both spawned and set as the current weapon at the same time, and the "current weapon" is set to null on the client because the weapon isn't synced yet.
I'm hoping a second OnRep_CurrentWeapon() call happens when the actor replicates as well, but I assume that doesn't happen. In which case I have to do a "bWaitForSync = true" or something...
it should execute OnRep once again if the actor is already there
Oh you're right, I just saw this happening, yay!
I'll just ignore a nullptr current weapon on clients then ๐
Yeah when UObjects are "mapped", any properties referencing them will trigger their rep notifies again
Same is true for objects in structs/arrays etc.
The idea being that you can workaround race conditions
anyone knows how and when Unrelaible Server RPC are sent as UDP packet ?
I'm making my own fast pace movement component and want the input to be send as soon as possible ๐ค
should I call unrelaible-server rpc every Tick and and let the engine decide ? I guess engine merge them and send them when needed, this way I may full the buffer if my input data are not little
or is there any Event to tell us hey we are going to send a packet to server
๐ค
hello guys did anyone worked with AWS GameLift in ue_4.27 with a team of 10 people?
with any version control like git
if anyone did then please help me how to setup
like that
@rose egret All packets are sent via UDP. There's no callback for when they're sent.
They're just appended to the outgoing buffer for that frame, providing they fit in the remaining space
Guys does anyone know how to use Google cloud for ue4 multiplayer
Character Movement does exactly what you're describing, but sending every frame is a bad idea - so instead it tries to pack up subsequent moves, up to a maximum delta
Speaking of, does Unreal make sure packets don't get duplicated?
guys any one?
There's a channel specifically for this, #source-control
@twilit radish yep - or rather, it doesn't process duplicates
Sooooooo, I have a fun little thing to just casually discuss. Might be interesting for more people:
Movement Corrections for Clients that collide with AIs and maybe even other Clients.
That's an issue that we are currently facing in one of our projects and just from the knowledge I have about the CMC I don't quite know a solution.
What I think happens is that the Client collides with the AI either on Server or Client first, because the Location of the AI is not 100% in sync.
AI for a Client is a simulated proxy, so they only get some location smoothing and that's it.
The Client's Character has a dash that, when hitting an enemy, bounces the AI backwards and stops the Client more or less in place.
Now while this works, it causes tons of corrections for the client and the AI.
I think we are doing the launching of the target Client-side too, as theoretically Client and Server are 100% in sync due to the timestamp stuff.
But their target is not, because of the simulation. Is there something build into the engine for this already?
Anyone having dealt with this before?
The engine features it's own ways for multiplayer, Amazon simply offers for example matchmaking and a place to host dedicated servers. There are plenty of others options to do things. I would recommend reading through this: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/ along with this: https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
Does it have to be cheat proof?
guys is there any proper tutorial like how to start multiplayer, matchmaking, room creating, spawning into game and start playing,
like all tutorials even payed also its ok i didnt find any one like this
Probably on GameLift end. I don't think there is anything about this in regards to UE4
But the question also lists multiple things that are partially UE4 and partially whatever backend you use
There is enough tutorials about just UE4 multiplayer that you can find
if there is nothing how a beginner will start?
Usually beginners don't make projects that require AWS etc
You should learn about UE4 multiplayer in itself first
even after multiplayer aws is new right?
ok any links or tutorials
Thom listed stuff already
ok
My Compendium is probably a good start
It's information rather than a strict tutorial though
what?
The second link Thom posted
Probably not, it's listen server based anyway. I thought about just accepting client side location on server...
Yeah then start reading the pdf
Is the dash instant or does it like build up?
It's instant. But it's build into the CMC in C++
An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.
Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe
00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...
You can also try this
There are lots of different things you can watch, probably good to get info from multiple places anyway
+1 for that video, it's well explained.
The problem I see with accepting the client location is that it will cause a 'correction' for other clients, which could very well also be acceptable but I guess that will also correct the AI right? Because if the client says "I hit them at this location" I assume the knockback will be applied from that location, causing a 'correction' because the AI may have been in a different place on the server at that point.
thx @thin stratus
Yeah they both get corrected
No matter if I predict the hit or not
If I predict the hit, it will 100% be corrected, cause there is no such thing as prediction on moving simulated actors.
And if I don't predict the hit, then there is a delay before the AI actually gets kicked backwards
The player gets corrected cause they just don't do the hit in the same timestamp
Either the client hit the AI in timestamp X and the Server didn't, so you will be corrected into the AI.
Or other way round, you will be corrected backwards to a stop
Shitty situation :D
Yes xD
If I accept client side, it will not correct the autonomous proxy, but the AI will still look shite
@chrome bay I know CMC do that but I did not see how .
I was thinking of packing subsequent moves based on time. but it add a little delay and not a good idea for fast paced when I want the input to be send asap
๐ค
It's quite simple. It saves the moves into a buffer before sending them. If a move is deemed "important" or the total delta time reaches the limit, it's sent
if CMC packs the moves when/how it decide to call a server RPC for sending them ?
It checks at the end of each tick
You'll have to look through the code to figure it out
But ultimately you don't want your bandwidth usage to be tied to how fast a client machine can run the game
so it packs movements of a single frame ? that doesn't make sense ๐ค
If a client runs the game at 200 FPS, it'll be hammering the server with packets and also limiting the outgoing bandwidth for all other systems
All the movement data is processed, then that data and the input is sent together at the end of the frame
But the point is you don't send every frame
You combine the movements together and send it in batches
Think about it, when a player is pressing "W" and moving forward more often than not, they're doing it for many frames in a row
I think the CMC by default only ever combines 2 moves into one, or?
It can combine as many as it likes up to the max delta time
Right, okay, which is 2 at a time though, based on the functions
But if you're lagging it might resend old moves
FSavedMove_Character::CanCombineWith is what determines whether a move should be combined or not
But you have to limit that maximum delta between combined moves, otherwise the server would snap even more severely
Characters don't move on the server until they get packets from the client, they're stationary
Unlike physics objects.. which is what makes physics prediction nigh-on impossible
tbh there's little point doing it the same way as CMC once Epic finishes the network prediction plugin
You won't have to really care about any of the netcode behind it anymore, it'll be a single solution for all
If you're making a movement component today, best to start integrating with that plugin IMO
Not yet finished, but certainly getting there.
the last time I checked that plugin was a year ago or even more,
I want to learn it cause im making some test with yojimbo as well , so that in far future I may try some king of custom replication for MMO game
spent several month to write replication system over yojimbo and failed
๐
I'm afraid I also don't really know a good solution Cedric, ideally I think the client that attacks should have the best experience because it feels extremely lame if you knockback an AI and it doesn't do it instantly. Maybe accept the player location and 'correct' the AI on the server to that position while predicting the AI knockback on the client? Should make it feel instantly for the client that hits but will obviously look a little weird for other clients.
If that's even possible, if so you could also try to see if you can smooth it out a bit with lerping or whatever instead of directly snapping it?
Yeah we might not get around accepting client location hmpf
At least when talking about simple solutions
The AI correction is pretty impossible in my eyes
The server doesn't know about the client hit, unless I pass that info to the server via the CMC
But the worst situation is actually still to solve
Player vs Player :D
Players can dash into other players?
Lovely, isn't it
Na, they movement can connect between AIs and Players
They are the same sort of character
Hi, can someone give me an advice of how to solve a login problem?
Explain your problem first
What i'm trying to achieve is logout a client of an account whenever another client log in the same account
So, i don't know what is the best approach to this
i'm currently using graphql to request data from my server
I thought to send a request after a defined time like 5 minutes and check if there wasn't any other client waiting to log in, but is this the best way?
I know games like Metin2 that logs out the current logged client whenever another client tries to join, but i don't know how
Any ideas?
Sounds like any request sent by the previously connected client should check for concurrent connections and drop the client
I'm currently sending request only on log in and logout, so it's difficult that way
Cause i need the first client to logout in the middle of login - logout when another client joins
I know about subscriptions in graphql, that i can send a message to all subscripted clients whenever an event occurs, but it opens a new web socket from server to each client subscripted, and that's a bit inefficient, isn't it?
Hello guys.Plz can anyone point a documentation on deploying ue4 server on digitalocean
For single test server, just build the project for Linux and run it. For automated deployment, that's going to be well outside your wheelhouse if you're having to ask this question
I am pretty. Much new to deploying.Can I get any on automated documentation on that?
Can I get any documentation on automatic deployment?
Hello, I am having a issue with my Dedicated server on linux on FWebSocketsModule::Get().CreateWebSocket, do I need to install anything else on the linux machine?
FWebSocketsModule::Get() is returning null, Windows working fine
I have a NetMulticast RPC that is Reliable on my GameState class which I am calling on a dedicated server. The RPC is invoked on the server but doesn't get called on my client. I'm running PIE with Run Dedicated Server enabled, Run Under One Process disabled, 1 client, and Play as Client chosen.
Any clues? It definitely isn't being called on the clients as I have a log that would print if it were called.
Are you calling it on Begin Play?
Might be calling it too early, i.e. before clients have received it
Could someone explain this warning to me ๐
Warning LogActor SetReplicates called on non-initialized actor BP_Pickup_Generic10. Directly setting bReplicates is the correct procedure for pre-init actors.
I'm really not sure how to fix this, i just know it's about the Pickup's i'm having placed in my level
Nope, it's called when something is damaged.
Does it matter if I call the RPC from within the class or outside of it?
It shouldn't
@vague fractal Don't call SetReplicates in the constructor
Set bReplicates = true/false directly
(until the actor is initialized i.e. fully spawned)
So replacing SetReplicates(true); with bReplicates = true; is really all i need to do ?
Like this will not break anything on dynamically spawned pickups at runtime ?
Only where you call it somewhere before the actor is initialized
I.e, constructor
From the message: Directly setting bReplicates is the correct procedure for pre-init actors
Alright, i'll just go with it then, thanks ^^
Can't wait for all the bugs that'll come from that ๐คฃ
Do you know is the network prediction plug-in specifically just for movement or is it more general? Because if you think about it, Position = HP, collision = MaxHP, move = damage. It's all just numbers, constraints, and operations on the numbers.
AFAIK it's just generalised prediction
but tbh, IMO it's better to predict as little as you can get away with. The added complexity from predicting everything rarely helps
Supposedly it's going to interop with gameplay abilities a bit better, but it's more geared towards movement
GAs has it's own prediction and apparently Epic is doing everything with that nowadays
I wonder why is my AVehiclePawn derived pawn so lagy even in PIE ?
does it support network by default ?
its my first time with replicated vehicle
Is there an event on the server that marks the first time I can RPC/replicate data to clients? I have initial state that clients need to have before other data gets send down. We were doing this in AGameSession::RegisterPlayer() but it doesn't seem to work anymore as that seems to be too early for clients to receive RPCs. This used to work, but maybe something in UE5 changed it?
@sterile plaza maybe AGameModeBase::PostLogin ? or maybe doing your main stuff after a warmup time ?
just send your initial data first, then after serval seconds start your game send other data etc ...
virtual void PostLogin(APlayerController* NewPlayer);```
does seem quite relevant, thank you
Is there anyway to use the WebSockets module on a Dedicated server? (FWebSocketsModule always nullptr)
<@&213101288538374145>
<@&213101288538374145> Manny missed one again
why are reliable multicasts not really all that reliable? is there anything one can do to make it better?
Im doing a drawing app and need the data to be sent reliably
right not im doing an rpc to server and a reliable multicast from there
but sometimes im not getting the data
even on lan with cables
What actor are you multicasting from?
a tool owned by a pawn
the data gets through most of the time
but sometimes not
i see segments missing in the drawn line on the client machine
the line is perfect on the listen server
im drawing on the client
Are you RPC'ing on tick or something?
im rpcing when i need to send the segment
this depends on the distance drawn and angle change
I am messing around with a project where people can swap between different characters where the controls and stats are different for each, I think putting all the (possible) controls into one player controller might be the right way and then the actual character pawn would have all the stats for each of the different characters with the different meshes. Anyone got any better ideas?
That's more or less what you should do
Like if it's an Overwatch clone, your player controller would capture your inputs, rpc the server, and then I'm pretty sure the server should be set up to run the actions on your player character, like if you use abilities or shoot
So if you press and hold "shoot," the player controller knows what hero you're playing because it references it for events, but it doesn't really care what type it is, because the inputs would all be the same
Okay so I am more or less on the right track here then, I had been trying to figure out the best way to go about this and wasnt sure where the inputs would be best suited to go
PC - has character agnostic controls. Like pressing escape to open the menu
Pawn - has character specific controls. Like crouching
At least - that's how I do it.
The Player Controller as Duroxxigar has pointed out should be for controls that aren't specific to the player's character.
You can create a base character that contains all your stats and what have you that all your characters will have. You then create subclasses of that character for each of your characters you have in your game. Anything that is going to function the same for all characters (like receiving damage and subtracting from health) should be on the base character. Anything specific to the character should be done on the specific character.
When possessed, your characters are fed input from the player controller automagically. So if you have say a "Low Punch" and "High Punch" controls, you can place them within the base character if they all work the same for each character, otherwise, in the specific character.
Makes sense, so like movement and things like that in the character pawn but then player menus and what not would be in the controller. And making the other characters children of the base character might do the trick as far as the stats, cause like I want them all to have a health component but the amount would be different for each, stuff like that
Correct.
If you define the stat in the base character, then you can always change what that value is in the child character.
Awesome, thanks!
This has been a big help, gets me going in the right direction
Does anyone know what conditions cause a Pawn's EventPossessed to fire when you are a client connected to a server?
(sorry repost from blueprint - probably better suited to this channel)
Hey guys, im pretty new. Would anyone be willing to put me in the right direction for setting up an easy dedicated server for my project for testing?
what would the most noob friendly approach look like?
So dedicated servers are not what I would call noob friendly but this guy has a tutorial that did help me get one going, if you follow it this will get you going in the right direction
https://www.youtube.com/watch?v=zNUxzl8Dcb4
How to build Unreal Engine from Source: https://youtu.be/MRJUWC90aJM
In this video, we go over how to set up and package a dedicated server for your Unreal Engine project. Dedicated servers are becoming a popular alternative to other game server options such as listen servers and peer-to-peer for multiplayer games. Dedicated servers provide man...
@fair lantern
I need a unique ID for every player, but I need to get it from their possessed Pawn/Character, where should I be looking?
Player index? Or maybe just the index number from the game state's player array?
I dont think gamestate's array is a good way because afaik it is not replicated
Every connection determine it when a player joined or left the game
So indexes might not match
Use the PlayerState??
It has a UniqueId property.
Which is the UniqueId of that Player within that Session.
(If that same player left and rejoined, the new UniqueId would be different).
Thanks, I'm still very new to anything outside of UMG/Slate
uh the UniqueId is the same
since it's their net ID
PlayerId will be the one to use for a single session
Yeah this one, mixed them up ๐ฆ
Trying to make a spectator mode with set view target blend. Anyone know why its choppy when in spectate?
it seems that by default player starts are random, in that a player will spawn at a random one initially and then at that same one each subsequent restart. Is there a simple way to make it always random, so I can test other stuff before making good spawning logic?
nvm I think I got it
in c++, can i OnRep 2 replicated variables with the same OnRep_Function ?
Sure
how should i do it ?
Exactly how you'd imagine you'd do it
just putting:
yep
Is there any guide for network prediction plugin? Just took a look to source code, does not seem to be that much commented
When a new actor is spawned server side, when do its replicated fields get set for the first time on the client? (Or if somebody could point me to the code where this happens that would be helpful).
As soon as it's spawned on the client
Any initial property states come down with the spawn packet
I should have been more specific: I'm trying to narrow it down further. Like before PostInitializeComponents for example?
Hi everyone! just wondering if someone here had an issue similar to mine, I have an actor replicating, when i spawn it on the server the correct owner is set and i can see that, but the replicated version has a null owner when i try to access it on begin play
Hi all, so there seems to be a bug with hosting sessions on 4.27 where it fails to create a session but works in 4.26, does anyone know of this bug and also if using the advanced sessions plugin will fix this problem?
nvm debugging OnRep_Owner i found my mistake, i was not calling Super::GetLifetimeReplicatedProps so indeed the onwer was not being replicated
Is this with steam? I recall reading on here that steam integration may be broken in 4.27
how do i connect to a dedicated server, the connection is timing out already have the ports open on the machine with the server running?
Hey guys, I'm needing some help with replicating animations for multiplayer. It's showing fine on the client, but not replicating to the server? So basically, I can see the character moving on the client, where I'm playing as him, but not on the server, where I'm playing as someone else.
It's showing that we're moving, but I think that the Anim BP isn't being properly replicated to the server. Any help? (Using blueprints)
Who owns a player's pawn in a regular multiplayer game?
Bah, I can't find anything about FFastArraySerializer usage online, was the documentation altered somehow? I remember I found some useful info on it but now there's nothing coming up
Does anyone know where I can some reading on it in the source code?
NetSerialization.h
Oh right, that just slipped right out of my memory, thanks
I'm having this issue where overlap events are triggering when they shouldn't be on multiplayer. So to explain exactly what's happening, the game is a fast paced soccer game, sometimes the on begin overlap function for the goals will trigger even tho the ball hasn't gone into the net. It only happens when the ball is being kicked at high speed and the goalkeeper hits the ball away or on very rare occasions when it hits the crossbar/posts. This is an example of it happening:
i posted this the other day but didn't get any solid solutions, only workarounds
im trying to change a text render when joining the server but it wont update from the default
is there anything im doing wrong?
RPCs are fire and forget. Unless the variable that is being set is replicated and being set on the server, the default value would only load on other clients that join after it was RPC'd.
so how do i fix this?
what are RPC
@sinful tree
the array is not changed. its the text thats being changed
Remote Proceedure Calls. Whenever you're using an event where you say "Run on Server", "Run on Client" or "Run on All" that's an RPC.
How does all of this get fired? is it on begin play of something? Is it triggered by the player requesting the text renderer changed?
Game mode doesn't exist on clients, so there's another problem.
You should give a good read through eXi's network compendium.
https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
Got this issue.. anyone know how to fix the lag? https://forums.unrealengine.com/t/spectating-when-dead-in-multiplayer/115021
Epic Online Services. Is that just interface tools for servers? Or is it server access?
@tepid pawn We have a channel for it.... #epic-online-services
Ask your question there...
I'm running some server RPCs in the player state. I'm calling these in the local player class. (E.g., ClientRequestblahblah)
Is there a particular reason for running these in the player state ? I feel like this is dumb.
Can't I just do it all in the character class ? -> the actual functions / events
Thank you!
Yeah with steam, haven't tried it with Epic but yeah its something thats broke with 4.27 as the same setup works in 4.26, im gonna test and see if it works in UE5 instead
When he drops it, the server needs to be the one to drop it
Is it normal behavior that traces on clients don't hit any replicating actor spawned by the server ?
Reported to mods
<@&213101288538374145> ๐จ
I'm trying to set the actor rotation in a way that replicates. Inside the ACharacter's tick I'm calling SetActorRotation but it's not replicating, what should I be using instead?
Usually Characters are rotated via their controller's ControlRotation.
It works on the listenserver for its own character but not on the client, it seems like the server isn't accepting it or replicating it?
I've tried wrapping SetActorRotation in an event that gets called on the server but that's not it either
Oh i'll try this
Bear in mind Control Rotation is often set locally.
Usually any form of server authoritive rotation set for character requires a manual override via a new replicated property or a ClientRPC.
Yeah it seems like that's not being replicated either
CMC might have something for that though. It does that for characters.
I wonder how it overrides clients rotations.
hey guys, I am doing replication so when my character picks up an item it disappears for everyone, but when he drops it, only the character that dropped it can see it, no one else can... can someone watch my screen and quickly tell me how to fix that? (idk why its not running on the server)
@warm sequoia It depends on how you're spawning the object, you probably need to tell the server to spawn it rather than calling SpawnObject on the client? I'm just guessing I'm new to MP
It looks like the listenserver is replicating to the client, but the client is not replicating to the listenserver.
AimingRotation is not set to replicate...
Odd. I seem to be missing an include somewhere that I can't find for Push Model replication.
UE 4.26.2
#include "Net/Core/PushModel/PushModel.h"```
These are both in the cpp file.
Only using DOREPLIFETIME_WITH_PARAMS_FAST and MARK_PROPERTY_DIRTY_FROM_NAME macros.
Getting an Unresolved External Symbol error.
Did you check your build.cs?
Oh. I don't know how I missed that. For some reason I thought Pushmodel was under Engine. Apparently it's NetCore. ๐คฆโโ๏ธ
I'm reworking some OWS stuff and I see it stores each player's session GUID in their player state. This is a very bad place to store this right? I figure in the context of how OWS uses it, the player controller would be the appropriate place to store it, correct?
you can just have RPC from server to client to modify it . GI are local to each client
depends, usually player state holds all player-specific game data
I'm just trying pull a setting from the main menu and set a repnotify with that value, not sure if that is even possible
I tried using the player state but wasn't having luck testing locally
I see as that because each player's playerstate will be replicated to all clients, having the actual sessionid for each player in it would be dangerous. Unless the server maps the actual Id to dummy ones for each client so it can't be hijacked
Oh I didn't look know you could override it like that. That's actually pretty handy.
It does make sense for it to be replicated to all though in OWS, I just think moving the session id would be a good idea so only the owner and server know the session id
Just tested on a steam build and it works!
Hi guys. So I have an AProfile* that is stored in the PlayerState, and I have this set to ReplicatedUsing. I'm noticing that when the server's PlayerState's Profile is set, the profile isn't 'empty' (not empty here meaning that they aren't the default values within Profile and that custom data has populated it). However, when this replicated AProfile* arrives on the client in the OnRep method, it's constructing a new AProfile (which makes sense, so it exists on the client), however none of the values that were in the server's AProfile arrive on the client. I have all values within AProfile set to replicated, as well as the actor itself. Any ideas?
void AProfile::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AProfile, Team);
DOREPLIFETIME(AProfile, bIsPlayerControlled);
DOREPLIFETIME(AProfile, PlayerOwner);
DOREPLIFETIME(AProfile, AIOwner);
DOREPLIFETIME(AProfile, bIsProfileEmpty);
DOREPLIFETIME(AProfile, Units);
DOREPLIFETIME(AProfile, TurnInfo);
}
AProfile::AProfile()
{
bReplicates = true;
bAlwaysRelevant = true;
SetActorTickEnabled(false);
Team = FTeam();
bIsPlayerControlled = false;
PlayerOwner = nullptr;
AIOwner = nullptr;
bIsProfileEmpty = true;
Units = TArray<AUnitBase*>();
TurnInfo = FTurnInfo();
}
void AArcanumGenesisPlayerState::OnRep_PlayerProfile(AProfile* NewProfile)
{
PlayerProfile = NewProfile;
if(PlayerProfile->IsEmpty())
{
UE_LOG(LogTemp, Warning, TEXT("ON REP E"));
} else UE_LOG(LogTemp, Warning, TEXT("ON REP NO E"));
}
I have a dedicated server in a linux machine and I'm running the client in windows, i can`t connect to the server at all. The ports are open and working, i can ping them from windows and i get a valid response. But in the game server the is no connection to the client.
OnRep_PlayerProfile(AProfile* NewProfile) it is not new profile but old one
onrep args always used to get previous values
OnRep_Score(int OldScore) etc
also you don't need to assign to it, or just remove parameter unless you need to keep track of old value (Which i'm not sure if works for actors)
You can set static mesh components to replicate. And then clients will display the mesh that was set on the server. What if the client doesn't have that mesh loaded? I'm doing an async load on the mesh on the server, but if it's just replicating, there's no comparable code on the client.
It looks like it has to run the OnRep, because there's work to be done when a mesh changes. But I don't see anything about loading the mesh.
I guess the data sent down from the server is sufficient...
one thing is data from server, other thing how it handled on client
if replication simply tries to FindObject then if it is not loaded - loading would fail
you may want to add a path to asset and replicate it instead of UStaticMesh* and relying on SMC
Should I be putting health in a component on the pawn, or inside PlayerState?
If it's on the player's pawn, couldn't another player's pawn get removed because they're too far away?
You can fix this like so #online-subsystems message
on pawn
player state is a layer above, for thigns like personal kill counts, stats etc
I was told that replicated variables such as health/ etc was stored in the player state.
Im guessing this was false info.
Trying to understand the expected behavior in the following scenario:
(1) On a given frame, server spawns an actor w/ bReplicates=true
(2) Server adds pointer to that actor to a replicated array: TArray<AActor*>
Now both the actor itself and the array need to replicate to the client. Is the replication of the array always deferred until the spawned actor arrives at the client, or is there a possibility it will simply replicate the array with a null element to denote the actor (which has not arrived yet)?
Quick question: Assuming the same listen server host, are unique net ID's always the same for clients that have joined that listen server? (For example, if a client leaves and comes back another day)
How hard is host migration in UE4?
Assuming you want it to take over from random host disconnects... impossible if you don't replicate everything to everyone at all times (or at least the minimum data required to reconstruct everything the new host would need).
Aside from that... still hard, but it's probably possible to do in a systemic way. You'd need to have some sort of system (probably a server you run) decide on who the new host is, have that new host save the state of all replicable objects from the current game (likely possible by just iterating over all actors and checking what needs to be replicated), have the new host start a new session + restore the state of those objects, have everyone connect to the new host and restore the state of any players.
It's not simple and something you'd want to avoid having to do unless you absolutely can't host dedicated servers (host migration is a bad player experience, and relying on people to have good enough connections to host is even worse).
Thanks! So I guess it would never be seamless, players would have some time leaving the old host and joining the new one, even if they didn't lose progress.
Correct, it will never be seamless. See: any older game that uses host migration ๐
I have very vivid memories of sitting around looking at a scoreboard in halo 3 waiting for host migration to complete...
Something that's true P2P wouldn't necessarily need host migration to deal with disconnects but... that's beyond the realm of what unreal's built in networking supports.
anyone know of common issues with steam voice in ue4 for p2p to improve performance? it is laggy hearing other people talk
PainCausingVolume not working. I feel like this is networking related.
I have a cpp function for OnTakeAnyDamage()
I can call apply damage and its binded properly.
In BP i was testing by making a custom event that runs on the server for ApplyDamage. This works.
The PainVolume does not. I checked collision settings.
Using UE5
To execute a function / set / get variables ?
yes
Cast to GameMode.
GetGameMode for the object reference.
Use "AsYourGamemode" to do things
assuming it's BP
im trying to press a button on a widget to send the message to the gamemode to print a string
to test the connection
Gamemode only exists on the server. You cannot retrieve it from a client.
Read the network compendium (see this channel's pins), it explains all of this.
That actually makes a lot of sense. There's a few OnReps I need to go change now. Thank you!
Anyone know? Just wondering if I should store a list of unique net IDs in order to load up the proper data when it shows up again.
things that specific to pawn must be in pawn
things that specific to player must be in player
health of unit is property of unit, amount of gold player has is property of player
Depends on the game though.. If you have a game where for whatever reason you can switch between pawns but they share the same health per player then it obviously wouldn't go in the pawn. Just think logically about it: "Is it a state that is directly connected to a pawn, or is it more of a general concept that isn't necessarily related to a pawn and thus should go somewhere else?".
usually they are unique identifiers of players. for example steam id is being used in steam OSS, not sure about others
yeah, that is theexception
if some kind of global health that is not related to pawns specifically
that way it won't be a property of pawn
๐
Hello
How can I use epic online services with unreal engine?
I'm confused and there aren't a lot of tutorial out there
I want to be able to login and have a friends list system
You can ask in #epic-online-services - but everyone I know who uses EOS and Unreal uses the EOS Online Subsystem plugin by Redpoint Games rather than doing it directly. There's no official plugin that I know of at the moment.
I tried to use this plugin but I never got i working (since it's the free version there is no support)
Maybe you should pay for it then if you really want to use it ๐
Otherwise you have a long road ahead of you figuring it out.
sorrry im here again but im haing the player spawn as a camera to select teams and i was wondering how i can make them control another actor when they select thier teams
I don't have 120$ :/
Also there are a lot of tutorials for steam subsystem
but if I use it will I have to post my game on steam?
Yes I think so. Steam will also cost you $100 for a Steam product code.
dang
Honesty the price isn't an issue
It's just that I don't think my game is good enough to be released on steam
Is there any subsystem that aren't for specific stores
Like a universal one
So I can just host and join games
You can use Null. It requires IP addresses for connection though if I recall correctly.
NULL won't allow you to search and find online games though
Null is a good starting point then
ok