#multiplayer
1 messages Β· Page 670 of 1
@violet sentinel then how do i change the ALobbyBeaconHost class ?
everything looks super unexposed
don't you spawn it ?
possibly, i am still digging my way through the lobby beacon system
there is a marketplace plugin (although it is a bit pricy and messy code-wise) still shows basics of working with beacons
unlike rest of engine code
π
nah would rather learn, nothings too hard :
essentually a GI subsystem that manages beacons
more reading π
when creating lobby, spawning the beacon host actor
still confused they didnt expose stuff to config
for things like the beacon classes
the API is barebones
without a single implementation for OSS
like every time i try to use (mostly Steam) OSS, find unimplemented functions i get urge to just write own OSS
Good morning! How are you guys handling different commands for different equipped items? Ex. Apple vs pistol. Are you sending generic commands to the item and allowing it interpret? Ex. Press button A for Action1 and button B for Action2? The parent Item class (or interface) then interprets and reacts accordingly.
either having object to provide Interact() / Use() method that they implement (if many unique actions)
or having a helper object and representing "Action" : "Interactible", "Usable" and actors configuring which action they support (if small amount of action types and many actors)
there are also other ways with utilizing hierarchy or composition
and in mp with everything being handled preferrably on server, and client receiving vfx/notifications
I believe your first statement is what I'm shooting for. Let me restate the question a little...
A weapon may have fire, reload, change fire mode "buttons" or commands. An apple may have eat, drop or throw commands. How are you genericizing these commands? Or are you?
Action1, Action2, Action3?
All of these action functions are exposed via an interface or generic base object Item.
?
i have a generic base actor
For your "item" class, right?
(AKaosWeapon) and everything like Grenades, Bandages, Guns, etc all use this base (yes it was JUST weapons, but i adapted it :P)
I use GAS tho, and pressing input key, gets your equipped item, and does what it needs to
GAS is an acronym?
i use GAS, so each item has 3 abilities, Primary Activation, Secondary Activation, Auxiliary Activation. For a weapon this is Fire, Aim, Reload.
Gameplay Ability System
they don't have to have all 3 abilities
Ok. That's what I'm looking for.
if they don't have that ability, nothing happens
I was considering something like that. Multiple generic commands that the item doesn't necessarily have to implement.
example bandages only have 2, left mouse and right mouse (Primary and Secondary) primary heals you, secondary heals what player you are looking at and close too
Yep. Ok. Perfect. That answers my question.
I spoke too soon. Is reload assigned to one of the Activation commands?
I'm assuming so if you are maintaining the generic interface.
@sly barn also don't cross post into multiple channels. Reload is an ability. You press the R key, it grabs the equipped weapon and calls Weapon->AuxiliaryActivation()
that would assume they have a central system to work with beacons which they don't have.
even significance manager is working within FSignificanceManagerModule but beacons are just api skeleton that you somehow need adapt: create GISubsystem, inherit BeaconHost, BaconClient, BaconState and manage them
also don't forget to transfer them on seamless travel
I feel like I'm missing something important. I thought 4.26 was supposed to support Pushmodel by default? Yet Any time I implement a property that is replicated with pushmodel = true, it replicates regardless of marking it dirty. Also the RepNotify setting doesn't seem to have any effect.
I feel like I'm missing another setting somewhere? Project wide or something?
yeah, it is enabled by default in 426
IIRC you have to compile the full engine with it enabled
it was completely disabled in 425, in 426 all macro active
Wait. Pushmodel requires an engine build? O.o
it is kinda a global feature
I'm working with source, if I add bUsePushModel = true to my target, it recompiles the engine
Which makes sense, since USE_PUSH_MODEL is an engine-level define
you can check it with
#if !WITH_PUSH_MODEL
#error Push model is off
#endif
BTW note that all properties are marked dirty by default
^
So if it is working, they'll be dirty first time, but not after that until you mark them
Oh I'm wrong, looks like it is on by default in 4.26
My test scenario was using an int32. Initialized to 11. On Beginplay, server set it to 12. Was running OnRep without marking it dirty. But if I changed the 12 to 11, it wasn't running the OnRep.
That makes sense
The property will be gathered at the end of the first frame
So it the actor was spawned + changed the property in first frame, it will replicate initially
Fair. What about the OnRep setting though?
Well it's 11 by default, so it won't be sent
Server will only send it if the clients value doesn't match
And even if it sends, client will only fire the OnRep if it's different from the local value (by default)
Even if you mark it dirty it might not send it
I had the OnRep set to Always. So that doesn't affect server sending a value when marked dirty?
Moo.
Server will only ever send a property if it thinks the client has a different value
Is there an override for that?
Always just means it will fire OnRep even if the property is the same
So.. TLDR, if you need what I want, set an initial only value and RPC it.
What was it you wanted?
For an OnRep to fire on client, and for server to send it regardless of change.
Yeah if you want the server to send it no matter what, RPC it
or override the == operator to always return false but that's sp00ky
For instance in the event of client predictions, server doesn't know what client might be predicting, but it sends an authoritive value. I still want it to send that in some cases even if it's still the same on server if something else happens so that client can use the authoritive value to correct.
Yeah the only way you can do that is uniquely identifying it. With a counter or something
GAS obviously uses prediction keys, and RPC's to ack/reject them
Or the key replicates with the changed property
hey guys, In UE4 my game works fine but when I try to launch game from file explorer it is just a black screen... anyone know why? I never got this before
Play-in-editor works differently so that makes sense
Make sure to open your game in editor on the entry level
And then debug it I guess
@bitter oriole it is being opened on the entry level... that is why i am confused lol
does APawn::UnPossessed() only get called on the server?
yes
I see, thanks!
I've seen some BP functions in C++ use the specifier BlueprintAuthorityOnly so that it only runs on the server. Is there an equivalent of that for non-BP functions?
Example:
UFUNCTION(BlueprintImplementableEvent, BlueprintAuthorityOnly)
void ReceiveAnyDamage(whatever);
I'm talking about a case where you want a C++ UFUNCTION to only run on the server. Is there a UFUNCTION specifier for that?
Or you would just put if(!HasAuthority()) return; at the beginning of the function to make it server only?
Not really. Those specifiers are pretty much just an easy way to stop designers from doing things they shouldn't. It's more assumed that if you know C++, you have a vague idea of what you shouldn't do.
hi, I have a few issues with the way the character movement component handles movement packets
I have an enum that stores the current state of the player (which can be wants to slide, sliding or none) and I send the data of this enum in the compressed flags
my system works pretty well but I have noticed that in high ping/packet loss situations the update out of sliding can be somehow skipped and the cleanup doesn't happen (so movement is stuck to the plane of the slide server side)
this is the way I'm currently handling it
void UYmenokMovement::OnMovementUpdated(float DeltaSeconds, const FVector& OldLocation, const FVector& OldVelocity)
{
Super::OnMovementUpdated(DeltaSeconds, OldLocation, OldVelocity);
const AYmenokCharacter* const Character = Cast<AYmenokCharacter>(GetCharacterOwner());
if (!Character)
{
return;
}
if (YmenokMovementMode == EYmenokMovementMode::Sliding && Velocity.Size() <= 50)
{
StopSliding();
}
if (YmenokMovementMode == EYmenokMovementMode::WantsToSlide && IsMovingOnGround())
{
StartSliding();
}
}```
I assume on server side there can be cases where the movement mode is set by the autonomous proxy to None (since StopSliding does that) without the server actually simulating that to call StopSliding
I'm considering making StopSliding a reliable RPC at this point but in high ping situations it could take time ...
I want to make the server check the previous move it received and see if it was Sliding and then the last move it received to see if it's not sliding anymore and run the cleanup again to make sure
I see, so if there's no specifiers you would just use if(!HasAuthority()) return; ?
Maybe. Depends. If I'm trying to make sure things run on server, my go to is usually if (GetNetMode() < NM_Client)
for a server RPC call to be successful, do I (the client) need to have ownership of the class object where the RPC is defined or the class object from which the RPC is called from?
For example, I declared+defined a server RPC on the PlayerState but then called that server RPC function from my PlayerController on the client side.
the owner must have a route to the player controller
The object that the function is called on.
so your pawn can own that actor, as pawn as a route to the player controller (owning connection)
RPC's from playerstate is fine, as its owned by the controller.
A better example might be if you had an RPC on PlayerController. You could call that RPC from a Widget which has no networking. This would still work since the RPC is through the controller.
Hello! Quick question, I think...
Which classes are involved in moving user input from the controller, through to the network? From what I understand replication and events involved - I may be misunderstanding - so I'm just trying to track down how the classes and threads involved work together.
does anyone know where I can hook my function to check if there wasn't an important unsimulated move server side? π
eh?
I have a sliding system that I handle with a replicated movement mode containing an enum for the state of the character
and my StopSliding function is called on OnMovementUpdate to cleanup from the sliding settings when the player becomes slow enough
the issue is that with high packet loss sometimes the state where the character is slow enough and still sliding gets skipped so the cleanup never happens
but I can still check for that if the last acked state was sliding and the current state is not sliding
I don't know where or how to insert that though
I'm thinking about overriding ServerMove_HandleMoveData
Is there any good example code of network projectile prediction
Apart from the unreal tournament?
Pls helpπ
no clue sorry
Does anyone know how to make the Start Separate Server in PIE start on a different level?
I'm running in Standalone and want client to start on my Menu level and server to start on the game level
none of the editor / project settings that I've tried seem to work.
ok what I did was add an Open Level call in my level blueprint. If dedicated server, load my game level.
LogNet: Warning: TravelFailure: ClientTravelFailure, Reason for Failure: 'Invalid URL: /Game/TestProject/Maps/Game'. Shutting down PIE.
for some reason i get this when i open localhost:17777 on the client side in the console
If I use open to try and load the game level on the client (aka not through the server but just locally), it loads for both permutations of the game level (short name and full path name with /Game/...
if anyone was wondering I figured how to do it
I added this to UpdateFromCompressedFlags : ```cpp
const EYmenokMovementMode NewMovementMode = static_cast<EYmenokMovementMode>(Flags >> 2);
// Stop Sliding if the sliding stop was not simulated
if (YmenokMovementMode == EYmenokMovementMode::Sliding && NewMovementMode != EYmenokMovementMode::Sliding)
{
StopSliding();
}
there's really no magic formula to make things less jiterry with 500ms ping and 20% packet loss
but this makes sure that at least the player won't be stuck with the plane constraint on
haha yeah if the network is that bad you are doing well as long as its not a catastrophic failure kind of issue
:triangular_flag_on_post: Trinigio1#2949 received strike 1. As a result, they were muted for 10 minutes.
Unsure if this belongs in here or in #blueprint - mods please lmk
I have a 2 player game, when the game is over I want to press a button and restart the same level, with the same 2 players (re-init the map, recreate all actors etc..). In the game mode i call Restart Game (which from my googling seems to be correct?), the server restarts correctly and loads the client that's also running as server, but the 2nd player seems to be stuck forever in the previous game. What am i doing wrong? (Yes i'm pretty new to the unreal ecosystem)
Does anybody know why my animation blueprint seems to always think that clients rotation is always either 90 or -90?
https://streamable.com/dx4dxx
its never in between those values and it doesnt even bother trying with the look up angle
the rotations are replicated to the server
is potentially time always 0 or always 1, or jumps directly between those 2 values?
it looks like time is always 0 for the other client yeah
ill try making it a value that gets sent to the server as well and see if that fixes it
so RInterp To never actually interpolates, as time is always 0, you always get current as output value
thank you for the advice ill let you know if that fixes it if so you are a lifesaver haha
Sometimes anim notifies aren't triggering on the server, is there a setting I can use to ensure animations happen on server an client
Alright, the time is replicating correctly now, but still seeing the same issue. Strange.
is Time an actual deltaTime?
I'd put a few Print String or breakpoints around that area, and figure out which parameter looks wonky
it looks like the issue is with my control rotation
the server thinks its always 0, the client has the correct
Did anyone make first person in multiplayer with third person look for another player?
Many people have
Lol
at least one person
Is there a way to check how much oodle is compressing network data in 4.27?
hmm im having some wierd interaction
using ray traces to for stuff fails unless server is looking at it happening after restarting the server controller
works just fine before restarting that player
without researching it too much I figured i'd check here if its something stupid XD
getting the traces done client side but not server side when out of view
check ue network profiler, it may have the stat
Is it normal to get very bad performance in 'run in standalone' for multiplayer? Normally I test using 'new editor window' and have okay fps there but if I try 'run standalone' I get terrible performance which is worse the number of players I select, but is this just my pc not being able to handle 4 separate instances of the game running together?
running four different instances of game could be quite difficult (depends on hardware) but the network part shouldn't matter much
what do you mean?
Are you saying the lag is most likely caused by having the four separate instances so is not necessarily a reflection of how the game would run on 4 different remote clients
Which on standalone 4 player mode on my home computer is fairly smooth at the moment.
is this only in mp?
how does push-based networking work over structs?
same as scalars, value sent only when dirty
and marked dirty initially
you mark fields manually i ncode
no, you have to mark struct
and then it only replicates what changed, I assume?
purrfect! Thanks Aquanox!
replicates only when marked as dirty
mhm got it hehe, I just didn't know if there was any difference in this case
you can modify struct contents but it won't be checked or sent until you mark the struct property as dirty
oki, as long as it only replicates the modified fields and not the whole struct, it's okay
no it will send whole struct
what if I want to replicate only the property that changed within the struct?
check net delta serializers
perfect, will do!
also another question
I've seen that they do
MARK_PROPERTY_DIRTY_FROM_NAME(..., blah, this);
blah->Mutate();
rather than
blah->Mutate();
MARK_PROPERTY_DIRTY_FROM_NAME(..., blah, this);
why is that?
ahh good to know
Does anyone have good spawn logic for an arena shooter that they'd be willing to share? Mine currently just gets a random PlayerStart and then checks line of sight until something passes. Too random imo
I've actually thought about putting some functionality in the PlayerStart BP to upkeep a type of "score" for how strong a given spawn point would be, but I'd have to maintain that for multiple teams while avoiding making it too complex
Hey, could someone point me to the class that handles variable replication? I know that the general idea of how it works is it loops over all replicated properties and updates ones that have changed. But I can't seem to find where the engine actually does this
somewhere in depth of netdriver
break on prereplication and look here it is called from
why do you need to know?
Because I'm learning the engine
thanks!
Anyone know why when simulating bad ping. The walking and jumping is tolerable but multicast functions like shooting really delay in response ? Even when its reliable
so on Fortnite there is a shop that changes every day without updating the game
how would I be able to do this in a multiplayer game?
I would imagine they have for example web servers that the clients connect to when they launch and then fetch whatever is needed from there.
Hello; I'm working on a project and have a few multiplayer networking/replication related bugs. I was hoping someone could pair with me for a bit to give me a hand. Happy to compensate if necessary. Is this something that this Discord is good for or is this considered spam?
Reliable could be the issue on it's own, reliable messages I believe are put in a queue so they remain in order etc. But that can obviously get filled up quickly with things like shooting. But I'm not sure if that's the case, maybe the network profiler could tell you more.
Character movement is predicted locally which is why it still feels responsive. Nothing else is.
It being reliable doesn't necessarily matter, messages between machines are always delayed by latency. It takes clever programming to workaround that lag and reduce the perceived effects.
How do I get shooting to feel a bit tolerable in high ping
Do I need to adjust configuration values?
Ah I understood the question wrong I guess, I thought they were being bottlenecked π
Look at Epic's shootergame example, specifically how they trigger firing effects
I mean when I shoot 1 bullet it literally takes 1 second to response at high ping. For example in a server in Italy while I'm in the US
Well yeah but that's just what ping is
latency. Nothing you can do about that
Have to workaround it and "fake" the responsiveness
That's the big problem with multiplayer, it doesn't happen instantly. There's always a delay of some kind π
But again jumping and moving feels natural
Yeah because it's predicted locally as I said
If it wasn't, it would feel just as bad
The Character Movement system is the only thing that has this concept built-in
I see.. is it possible to do some predictions with functions?
Anything is possible really
It's a complex problem, have a look at ShooterGame for a simple example
Dang lol
not sure if this helps, but the way I fire is by calling my Fire function locally first and then using an RPC to call Fire on the server which replicates the fire to the rest of the clients, and then doing client side hit detection with server validation. What that sorta looks like is:
Good start thanks
has anybody used photon on ue4? I wanted to know if it needs a separate build for the dedicated server
If you want to pay someone for it there's a dedicated section for it, if you have any specific questions you could just ask them here π
I can try asking -- I'm mainly wondering if anyone is willing to pair with me or give me guidance on a multiplayer issue. I'd be grateful if so. My issue is that:
- On map load I'm setting a bunch of properties in each player's state based on a widget. These properties are being stored in a replicated array
- Once a 'confirm' button is hit on all player's widgets, I kill all the players and use the info from the state to load something for each character (GAS abilities), which is called via a server RPC on Event BeginPlay
The result is that every client is able to load their abilities, but the host doesn't load his abilities
However, if I start the game from the level described above instead of from the main menu, it all works properly. The main menu will use the Advanced Sessions Plugin to connect all of the players and doesn't do much else
Have you tried this several times? Maybe it's an issue with the beginplay order where something has or hasn't been loaded yet? It's a bit difficult to say what could be wrong here, but that may just be me π
yeah agreed, the problem is a bit in the weeds rather than a general multiplayer question. I have tried it several times with a different number of clients and its always the host who cant load his abilities. I've also stepped through the debugger to try and make sure everyone's state is correct and it seems like they are
the fact that it works properly if i dont go to the level from the main menu makes it really challenging to debug since the main menu isn't doing much here
I would recommend trying to add debug messages or using a debugger again from the beginning point to the end. Other than that I'm also not quite sure, it's difficult to tell what the issue may be. It could also be that maybe something doesn't correctly persist or does persist from the menu to the other level π
Maybe step through the code from begin to end and see where it could potentially cut off something.
thanks man, i'll try that
level streaming is iffy with loading and begin play/tick order
I ended up using a custom event and Remote Event node to do what I want instead of waiting for begin play. Could too early begin play/ticking be the cause of your issues?
I don't think so because the flow is like this:
- The map loads and everyone interacts with a widget (begin play is called here, but it's not the relevant one)
- Every one dies (behind a loading screen)
- Begin play is called again when everyone respawns, and every time a player dies and respawns again. These are long after map load
this is basically the full menu. you either click host or you click join
those events are hooked up to buttons in the main menu widget
the loading screen is just a widget that takes up the entire page while everyone dies; doesn't do anything
hmmm
it really does seem like a problem that would come back to begin play and load order but I digress
hmm maybe i misunderstood what you meant by that. say more?
nah, it's all just 1 map
thanks anyway my dude
haha I have a somewhat similar problem actually XD
maybe i can help, let's hear it
after killing and restarting host, rpc event that should trigger linetraces somehow stop firing on the server when host isnt looking towards the event
where is the code that's triggering linetraces?
input client-> trace on server reliable event-> trace multicast reliable event -> linetraces
basically
im doing traces from an actor attached to pawn
which class type tho? is it happening on the player character? on a random actor? in game mode? reason i ask is because I imagine it's either happening on the player character or wherever its happening is referencing the player character. when your host dies, the refernce is lost.
and you might need to reestablish. that being said, a problem like this definitely needs eyes on it, same as mine. it's hard to debug from a sentence haha
yeah for sure
but lots of content to screen
if the problem persists I might be inclined
if it's happening from an actor attached to the pawn, it does make some sense for it to stop when the host dies at least π€·ββοΈ
whatever is happening is unfortunately not referencing the host player at all
and the wierd thing like I said
if the host looks towards the client
then the clients traces are run on server
if host looks away, traces are gone from attacks
on the server
but only after kill and restart
similar to my issue. i wonder if there is any setup that you do in game mode or game instance begin play
that doesnt happen the second time the host dies
hmm there is
is it relevant to this? if so can you call it from your host's begin play
slash from your player character begin play?
because that gets called every time you respawn, whereas the other stuff only gets called on level load
this might actually help
im not sure I get why the direction the host is looking changes anything
i mean im not doing anything complex
yeah in order to debug that i have to know way more about your game
that sentence barely makes sense to me without knowing what you're doing
yeah sorry
thats in game mode anyway
i'll do some more debugging
cheers
hmm no not really doing anything wierd there unfortunately, just simple spawning of a few actors(Equipment), attaching to sockets and play a spawning animation montage
i'll pop down what im doing, I ended up hardcoding alot just to try to debug this XD
get called from damage event
im probably making some simple mistake somewhere XD
im not reusing the equipment actors
I leave them
spawn new ones for new player
the equipment contains the linetrace code which gets called from multicast event
which fires on the client but never gets run on the server or replicated to other clients after host has restarted once and is looking away
Guess I could reset manually instead of calling restart
see how that changes things
I should just go code, blueprints get confusing by comparison XD
Hey can someone help me with this replication? Iβm not sure why it is only working on the server for all.
hmm
not sure what runs what here but
mayeb make the run on server event call a multicast event that runs the actual code?
then you can call the multicast event in places where you know its auth only
and the run on server event everywhere else
Doors should probably be set up with a state (using an OnRepNotify variable) rather than relying on multicast events.
Multicasts are fire and forget, and if the actor isn't relevant to one of your players, they won't receive the change of state of the door.
What you can do differently is create boolean variable for the door state - open or close - and set it as OnRepNotify.
In the OnNotify function that is created, you can then check what the variable is, and perform the needed action (open or close).
Your Server RPC would then just change the value of the boolean when you want to close/open door.
hmm probably something similar thats the cause of my issues
above
i'll refactor it for rep notifies I guess
No yours is a bit more multicast friendly, but it looks like you have code that should be getting executed on the server only in the Executes On All.
Though yes, death should probably be a boolean state on your characters which could still benefit from using an OnRep variable.
got a few more states yes, but could probably benefit from disconnecting death from the same enum
o7
for multiplayer, should i be putting input on the character or the controller?
It doesn't specifically matter, however, you'll generally haver a better time if you keep anything that is character specific on the character - so things like movement of said character, any abilities that character has, etc., but then put anything that isn't character specific on the Player Controller - like menu/ui controls.
Hey guys been racking my brain but can't find anything that tells me why my instances are spawning sideways. Any ideas about how to rotate them to be upright?
Here is my BP and the issue
if i apply a Root Motion Source to a player on the server (not predictively) i get a ton of jitter and corrections on the client who had the root motion applied to them. Any way to fix this? For root motion a client applies to itself, i can do it predictively and then on the server, and it works great. However for something like a knockback, that is initiated by an NPC on the server, how do i smooth that for clients that are affected? do i just have to apply it on affected client after the server? Or do i need to RPC to the owning client and delay applying it on the server until the client has applied it to himself?
@tepid pawn MakeRotFromZ will align the actor's up vector with the normal
also what does this have to do with multiplayer?
(RotationFromXVector aligns the shrubs forward with the normal)
Oops Must have accidentally clicked multiplayer (rolls eyes).
Thank you so much for the help. I'll look into that π
if i create a uobject on the server with a bunch of replicated variables, and one of them is OnRep, is the OnRep going to fire randomly with some variables replicated and some not, or will all the variables replicate at least once before the OnRep is fired off?
what i mean is will the client have all the initial values for variables before the first OnRep call
From what I understand, UObjects do not replicate by default. You have to do some magic in C++ I believe to make them replicate.
I know how to replicate UObjects, just wasnβt sure if it was safe to use OnRep of a variable for basically an Init function on the client
Righto I'll shuddap π
If OnRep fires before all properties are replicated basically
As long as the properties are in the correct order then your good. If you want to do stuff after all props are set you can use PostNetRecieve with a bool gate for first time.
TIL about PostNetReceive
Are properties replicated in the order I declare them?
I didnβt realize that
Typically yes
Test it lol
Two rep props with log in the independent
Onrep
Stupid phone lol
Anyone else ever have a project completely stop working? Variables, overlaps, etc don't work anymore lol
did you by any chance used hot reload lately?
Shit I might have, why?
I will use a good old one link here:
http://www.hotreloadsucks.com
hahaha thank you, I didn't know about that
Hey ive been struggling launching a dedicated server on ue5. Did the same steps for ue4 26 and worked successfully. Is there any documentation for ue5 multiplayer setup
They are but in Epics own words: "this shouldn't be relied upon"
That's why we have PostRepNotifies etc etc.
Guys is that normal that Net Cull Distance just breaks replication but not trying to recover replication once player is close enough?
Not really sure what you're asking, breaks how exactly?
It's certainly not normal that it "breaks" anything
Like I know that it will stop replication if player is far enough
But will it replicate if player gets closer again?
It will yeah
If it's an actor spawned at runtime, then the actor is destroyed/respawned with network relevancy. If it's an actor that's serialized with the level, then it just stops/starts
Hey, I'm trying to make a local coop where Player 2 is not spawned, but is a result of possessing an existing AI Pawn. How could I achieve that?
Something you'd handle at the GameMode level most likely, take a look at RestartPlayer()
The default implementation always spawns a pawn for new players at a given player start. Presumably you'd want to look for an existing pawn first
Seems like im doing something wrong as for me it never starts back :/
I want a game in which you can have human players or bots or a mix of two.
I understand that you have the PlayerController (Human) and the AIPlayerController so I can switch between them.
But, for example, If I want to keep track of some character-driven values like: "Heath", "Ammo", "Team color"... My first guess is to use the Player State, Is that a good way when using AIControllers too?
Yes
Thanks!
<@&213101288538374145>
Hey Guys, Whats the best way to implement third person character on a first person game? I know bad ways to do it that work, but games like Call of duty and stuff tend to do it really well and accurate, Are they adding FPP arms and then adding a third person body or whats the best way?
ShooterGame has an example
But yeah they add 2 meshes
make them visible based on controller
if you are local controller you dont see 3rd person one
Most FPS multiplayer games dont use single mesh
hey guys dumb question what does marking something as dirty means?
In general terms it means that property will be updated on next update/tick
I guess you saw in on push model?
Thanks π
yes and im looking at some source code for something im working on and i kept seeing it mark as dirty
With normal system engine loops each property and checks for difference, if property is updated its being replicated
With push model, you need to mark it dirty
So it will not loop it forever and you will save performance
i.e. its a manual way of pushing updates across network
Hello everyone.I am spawning a actor which I marked as replicate.I am spawning it on game mode.But actor is not able to spawn on clients.When I set to simulate I can see it spawn.Plz help me here
Any actor is not able to spawn here
Are you playing with listen server model or dedicated
Hi, i'm having trouble creating a widget after a map change
Does someone know why my game instance does not execute an event "Show message" when i load the main menu map?
This is my setup
after i call open level i'm trying to show a message that "someone logged into your account form another device"
But the "Show message" event does not seems to work
Show message is in the game instance too
any ideas'
?
After the map change i tried to show the widget many times with another error message from another event, but it does not work anymore
@peak sentinel I figured it out.it is not spawning properly on game mode.Now I am spawning on game state.I have one problem.i am spawning Pubg blue zone type of thing. I had a sphere component to the actor and I made it replicates as well. But when I am trying to reduce its scale on server it is not affecting on client but when I do it on multi cast it is working do you know any reason why it is happening thank you
i post this here because my map load is opening a server
@golden nest when you open a level there will be a player controller.Try to spawn widget there.Game instance is generally used for maintaining data throughout levels not for spawning widgets
How are you calling the spawn widget function in game instance??
what do u mean?
I have all my main menu widgets in game instance :C
I open the level then i call the event to show the widget
I think it is bad practice to spawn widgets on game instance.Maybe I am wrong.never mind.did you print any string to check that function is being called
yes, i printed a string with no success
the event never fires
i noticed that there's a problem with lan session
Because i can travel to any map with no problems, but when i create a session, then come back to the main menu, the widget stops working
nevermind, i solved it haha
There was a problem with the destroy session, i call it, then open the level. Opening the level then destroying the session seems to work
@dusky radish In general, everything past the button click, which should call a ServerRPC on the controller, should be done on the server. Replicated Pawn should spawn on the server, and the server version of the controller should call possess on it which is all you should need to do I believe.
There doesn't need to be any other networking past that. The Possession code will handle it all for you. If you need a client to respond to possession, I find it's better to hook into the client RPCs made from possession routine and add a binding call in them.
Hey,
i want to ask how the multiplayer (Host/client. No dedicated server cause it's too complicated) in unreal engine is. I wanna make a multiplayer arena fps shooter game but i don't know,
if it is going to lag if like 300 people play it simultaneously. I do have multiplayer experience with Unity (Photon Pun) and when i tested the game with many people there, it started lagging.
So i wanna know if the unreal engine networking stuff can handle many players.
You wanna have listen server, not dedicated one and 300 people on 1 server?
I am not that familiar with this system, but i wanna have for one host 12 clients
but previously you were talking about 300 users. You meant 300 users in general using your game spread over multiple servers?
yeah, but what do you mean by servers? @empty axle
either dedicated ones or listen servers(playing player is also a server)
So if i host a game, it's a server?
yes as well
And those that connect to it are clients. Your hosted server is the authority
ah ok
So can it lag or something if 300 people are playing simultaneously, but it's one host(server) per 12 clients, on a arena fps shooter?
Do the 300 people actually have anything to do with it?
A part, yes, but there's hardware factors there too.
it may lag for players if the host have weak CPU and your game is not optimized well
Regarding those 300 concurrent users that depends on your backend, if you have in-game store, friends, matchmaking, authorization etc. depends.
oh damn
How would one set up a system that allows 300 players connected to the same game instance? I'd imagine a load balancer and distributed computing is required - what tools do you know of for that? What sorts of optimizations would be required?
Same game instance? You mean like the same server?
The same logical server.... Itd have to be a pretty large computer if it's the same physical server.
Yep, currently not possible with plain ue4. With one dedicated server and some/a lot of optimization(depends on your game) you could get to 100 users
Does unreal engine have integrated matchmaking?
No, you need to use custom one or EOS or use non cross-platform ones like Steam
but the Steam one depends on which platform you are deploying
Oh alright. Thank you guys for helping me
is pc ok?
@split sentinel if you are deploying for PC and you don't care about publishing to Epic Launcher and GOG you could use Steam built one yes
I recall ShooterGame have some basic setup for that
ive just followed a tutorial online that works locally but to work across the internet i need to port forward.
Instead of port forwarding my own router i have signed up to Portmap.io that generates me a random port i can use.
How could i change the port in the game?
Yeah, I can imagine the sorts of optimizations that would need to happen to make it possible. It'd have to serialize game data to a distributed cache that each physical server uses to read the game state, session, instance, and relevant controllers. there'd probably need to be possibly separate authorities for various parts of the engine like physics, state, etc. It's doable but it's a pain and astronomical man hours. I'd use gRPC with sparse and size constant datatypes and a clean hierarchy.
does anyone know how to change the port?
Someone correct me if I'm wrong, but I think if that server IP address was an INetAddress, youd have a port.
It's a type in unreal that represents an address on the internet. An address is typically formatted like <ip or hostname>:<port>
I'm not sure that'll help you though, that's why I asked for corrections
ok thanks anyway
ive never done mp before but a 10 minute tutorial seemed to explain it all
but he only did it on LAN and claimed u must portforward for multiplayer
well, i'm sure there's another 10 min tutorial on port forwarding in UE lol sorry wish i could help more
thanks π
Hello reposting this from yesterday hoping it's not considered spam; I'm working on a project and have a few multiplayer networking/replication related bugs. I was hoping someone could pair with me for a bit and attempt to show me what's wrong.
My issue is that:
- On map load I'm setting a bunch of properties in each player's state based on a widget. These properties are being stored in a replicated array
- Once a 'confirm' button is hit on all player's widgets, I kill all the players and use the info from the state to load something for each character (GAS abilities), which is called via a server RPC named
LoadAbilitiesfrom Event BeginPlay whenever someone respawns.
The result is that everybody correctly gets their abilities after dying and calling Event BeginPlay except for the host. Using a 1v1 scenario (2 clients and the server) through the debugger, what it looks like is happening is when a client dies there are 4 instances of the LoadAbilities function which I assume is the client and the server both calling Load Abilities on both the player characters. However, when the host dies, I only get 2 instances of LoadAbilities as the other 2 that are expected are unable to cast the player state into my BP_PlayerState class
hopefully it's detailed enough. mainly hoping to pair with someone and happy to compensate for the time if that encourages someone to pair with me.
any way to replicate an object to only one client
(the owning client)
its a UObject derived class so I'm using ReplicateSubobjects to get it to clients, but remote clients shouldn't need it at all
I'm using an impulse node, and I can't figure out how to make it less jittery on the client. I've tried running the event on the client or the server and neither seems to make a difference
@vivid seal override IsNetRelevantFor
and make it return false for anyone BUT the owner
ah
thats for actor
yeah i think uobjects just use owning actor's relevancy
UObjects, you need to override ReplicateSubobjects somehow to only send to owner
tho i have never done this, nor needed to do this
okay, i didnt know if there was an easy way to do it. i wont bother, just guard initialization on clients with auto proxy role and eat the networking cost, its probably not a big deal rn
its for root motion sources, it doesn't seem like i need to replicate them to remote clients at all (it looks smooth and there aren't net corrections if i just apply them on server)
i run them on simulated proxies also
not sure how your not getting corrections
cause i did unless the simulated proxy ran them
i was getting insane jitter on the owning client (since this is for non-predicted sources like knockbacks) but none on other clients watching that client
not sure, maybe my test case was just slow enough that the smoothing from the server was covering it
i mean yeah the owning client and the server def need to run them
but i had issues where simulated would look weird
(for things like jetpack, etc)
im basically just copying constant force, move to force, and jump force from the GAS ability tasks in my own version
still not sure why you are reinventing the wheel π
not sure what you dislike about GAS
mostly already did a lot of what GAS does in my own system before I heard about it, and don't want to remake all of it. also I don't like the way GAS thinks about GEs, I have a distinction between "buffs" and instant things like damage that I like in my system. I also have buffs as objects that are instantiated because its easier for me to write blueprint logic for them that way rather than try to tie everything to an attribute modification or a gameplay cue. also I do prediction of cooldowns and have a charge system for cooldowns which GAS doesn't support out of the box, and looked like a pain to get working
we did that with our system in TRS2 (cause at the time, GAS was very little known)
and i dislike "Buffs" being able to run Blueprint logic
our game designers break all rules, basically turning buffs into abilities
its really bad, and i hate it, i really do like the GAS way tho, and GameplayEffects work perfectly fine
i actually hate that in GAS you have passive or automatically activated abilities rather than just letting buffs do logic
buffs should not do logic tho
i get why it is that way
that is how i see it
but i dont like thinking about it in those terms
well they are not actually buffs tho in GAS, they are Effects (i dislike the name TBH tho)
cause Effects sounds like FX
i think my biggest problem with effects is that they are an umbrella term for both buffs/debuffs AND instant attribute modifications
in my head those things are two separate categories of event
idk. the main thing is i just didnt want to relearn everything AGAIN
i mean i understand what you are saying, but if you think GAS way, it actually starts to become easy
and you get to understand how things work, and its really good
if i ever finish this game, my next game will definitely be GAS so that i can learn it
lol
can somebody help me smooth out an impulse node I'm using on the client? I've tried running on both client and server and disabling movement checks and it is still really jittery
do you guys happen to know a better discord channel or site to get my question answered? i'm only really able to find this one from google searches on ue4 help and by the (lack of) replies it seems like not the right one
This is as good as it gets. Can you confirm that all the expected data is making it server-side for the respawns?
Simulating physics or using the CMC?
using Character Movement
Use Launch Character. It's pretty much just an accident/handy overload that Impulse works on Characters
okay, I'll use that then
Test if it's already networked first, try launching just like jumping (local call). If it works, great, if it doesn't, well, you'll have to do some C++ to get predictive launching
I just replaced my impulse nodes with "Launch Character," and it's better but still slightly jittery
Try doing it on client only.
same way you do jumping
Not sure if that'll work but jumping is predicted so it may
If not, do it server only and live with it or bust open the C++
client-only seems to get corrected immediately
What does Server-Only do?
it launches but is jittery, I'm pretty sure
let me test it again
it functions the best so far, but there's some noticeable corrections happening
what if I use "ignore client movement error checks and correction" and then run on both client and server?
Running on both is not the approach I'm pretty sure. I'd look if anyone has done a multiplayer dash or leap. Launch Character might not be built for multiplayer
None of what I've found online is really helpful. Does this have something to do with net update frequency? I'm pretty close with it running on the server, but there's still some noticeable jitter
i can confirm this because i wrote a print statement that prints the abilities array as well as the character the abilities are for, and the server logs it all correctly
Launch has to be done with saved moves, itβs not handled by default
Hey can someone help me with why this is not replicating? I have a repnotify boolean to set the door as open out of frame.
Whereβs the onrep function? Also holy redundant casts
I tried following the initial multiplayer guide from unreal, and I can't get shooting to work so I wanted to log something happening, but I can't get logs to work at all. I've tried searching google but all I could find was the community wiki which doesn't help much in case you don't get any results
Show code/BP
I'm following this guide, which code do you want me to show?
https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/QuickStart/
The code that is not working
UE_LOG(LogTemp, Warning, TEXT("Hello"));
I'm just trying to log anything to the output console, and no matter what nothing happens. I've used this piece of code inside the MoveForward function, and various other places
No logging occurs
are you using the correct class in your game?
where is this log placed?
we need more info to help you.
I was too lazy to delete the code but i was bored and started putting a bunch of casts lol
@lost inlet thats the onrep
There's a default function for a character when you create it called MoveForward.
What do you mean using the correct class in my game? I've literally followed the guide, and things are running besides no bullets are being fired, which is what I'm trying to debug. Now I've spent more than an hour just getting an output log
I've also defined a BeginPlay for my character, and the log also doesn't fire from that
No it isnβt? Iβm interested in the onrep function not the functionality after setting a variable
Wait, you are asking the exact same question as this: #cpp message
Oh, I didn't realize he wrote as well, I am
strange, well if its not firing then you are not using the correct class in your game, or you missed a super call in your overridden functions.
Gonna need to see more
What have you tried? What does anything look like? Most programmers will know what a UE_LOG is
void AThirdPersonMPCharacter::MoveForward(float Value)
{
UE_LOG(LogTemp, Warning, TEXT("Hello"));
if ((Controller != NULL) && (Value != 0.0f))
{
// find out which way is forward
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);
// get forward vector
const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
AddMovementInput(Direction, Value);
}
}
This code should be fine right?
Given the class is called AThirdPersonMPCharacter
Yes and is your character BP actually deriving from that class?
Did you setup the input component
What is BP and yea, it's also there by default
void AThirdPersonMPCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
// Set up gameplay key bindings
check(PlayerInputComponent);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);
PlayerInputComponent->BindAxis("MoveForward", this, &AThirdPersonMPCharacter::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &AThirdPersonMPCharacter::MoveRight);
// We have 2 versions of the rotation bindings to handle different kinds of devices differently
// "turn" handles devices that provide an absolute delta, such as a mouse.
// "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick
PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput);
PlayerInputComponent->BindAxis("TurnRate", this, &AThirdPersonMPCharacter::TurnAtRate);
PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput);
PlayerInputComponent->BindAxis("LookUpRate", this, &AThirdPersonMPCharacter::LookUpAtRate);
// handle touch devices
PlayerInputComponent->BindTouch(IE_Pressed, this, &AThirdPersonMPCharacter::TouchStarted);
PlayerInputComponent->BindTouch(IE_Released, this, &AThirdPersonMPCharacter::TouchStopped);
// VR headset functionality
PlayerInputComponent->BindAction("ResetVR", IE_Pressed, this, &AThirdPersonMPCharacter::OnResetVR);
// Handle firing projectiles
PlayerInputComponent->BindAction( "Fire", IE_Pressed, this, &AThirdPersonMPCharacter::StartFire);
//PlayerInputComponent->BindAction("Fire", IE_Released, this, &AThirdPersonMPCharacter::StopFire);
}
Everything working besides the Fire action
I can move, see it from another client, like it seems to work great
I also tried starting a new project, made the BeginPlay function, and added the log. Nothing else. Still no results
I hate to ask but... You compiled the project, right?
I press the play button in the unreal engine studio
Okay so the official documentation is just bad?
It's not magical like Unity C# π
No? Thatβs just typical
No, it assumes you understand the basics of C++
I do, I'm a systems developer and am very confused I'm not getting logs. If I have to compile to get logs the documentation should say so
I assume it's compiling when I press play
A debug specific build
That is not how it works
I see
You need to compile ALL code changes
there is no magic "Press play and my code works"
Lol that's not what I'm saying calm down
I'm assuming it compiles when I press play
I was*
But it was though, you added a log line, and you expect it to work when pressing play. I am just saying, you can not do that in UE4. You need to compile all code changes, which is standard actually for all C++ programs.
Which I'm saying I understand is standard. I know what compiling is
But what does the play button do then
And code compilation does not take a few seconds
just plays what you have already compiled.
Okay great, that's something they could add somewhere, especially in the beginner guide. Anyways thanks for the clarification I'll return when I get my result
I work in Rust normally, I compile 100+ times a day when I change code
Its not beginner guide actually, it says Intermediate
The link you posted earlier wasn't a beginner guide for the engine, it was for getting started with multiplayer... Which assumes you are already are familiar with the engine.
I thought the UE engine studio compiled shit when I pressed play
Sure, it doesn't say so anywhere so I couldn't know that.
Bad docs, they should state it
Itβs an intermediate tutorial
It literally says intermediate
anyway, close editor, compile code, start editor, and things will start working
Yea I see, thanks for the help again.
You can turn on Live Coding for function body changes, and can compile without closing the editor. Only thing you can't do is header/constructor changes.
UE5 actually handles header changes
Does it now?
yeah, and its on by default
Haven't checked out ue5-main recently. Nice.
livecoding new classes in, etc
still rough around the edges
but it works decently well
and won't corrupt bp's
Hah, maybe in a year or two we can get rid of the hot reload sucks domain
Compiling works. Thanks for the help.
I know I should have read the initial beginners beginner guide, but the UI on the webpage is so badly made, it takes me like a second to locate the 'difficulty'. I've done a bunch of web dev, and I've never seen anything so badly placed besides everything on the amazon website.
I'm making a multiplayer game, and know it's important to implement the functionality from the beginning, so I assumed the multiplayer tutorial was also introductory
π
I have replicated property and i replicate that property using push models manually . just curios to know does this property waste cpu cycles on each frame on server or it take cpu cycle after i mark it as dirty ?
i put a breakpoint in my ReplicateSubobjects override inside a custom CMC class, but it's never called. Any idea why that might be?
apparently the CMC is not replicated lol
u shouldnt have to replicate CMC
oh wait
if ur replicating vars within a custom cmc then yea
but for default u shouldnt have too
Yeah Iβm having my CMC manage objects that handle root motion sources. Instead of using gameplay tasks and their component.
Any tips or good examples on how to handle client level transitions between menu and games? Do you have a single Menu level that knows if you just started or have come from end of game? where do you persist such state?
I fixed this bug FYI and it was kinda an annoying one. I had to add a delay at the beginning of EventBeginPlay because the host would call it before his own player state loaded. Why would that happen / am I not supposed to use Event Begin Play to initialize a character with properties from his state?
I guess GameInstance is the place I should save the session information between games for the menu to work
I need a dedicated server for each match or for each map? (For example fortnige need 1 dedicated server per 100 players in match/a creative match or 1 dedicated server for all the battle royale (normal modes that use the same map) and 1 for all creative?)
What would be best traffic wise between replicating a widget through component replication or using an actor variable with repnotify to update the contents of the widget?
or should I research what component replication does more in depth? XD
you can not replicate a widget
Hey guys. When I simulate my code on two clients its not working as intended, but if I simulate with the Listen Server and clients it works perfectly. Is this fine? Will the listen server always be active once Im hosting the server?
?
You would have a game server instance for each session
Each match. In your Fortnite example, if there are 1200 players playing, and 100 in each game, all playing the same map, you would have 12 server instances running.
Though in reality more like 10 with 200 players in matchmaking
To iterate on my previous question, I've read that the LSC is a server and a client at the same time - but lets say I setup a hosting service for my game, I dont wanna be connected as a LSC (as its generally a super client and wouldnt be good to debug MP stuff with I guess), but somehow my gameplay requires an active server to function properly. If I simulate as two clients without an LSC it breaks my tracing system for melee combat, but if I jump in as LCS it works for the clients. Did I do a coding mistake, or is this a fine behavior? Im not sure how serverhosting works and if that adds a Server which in this case would replace the LSC?
It's impossible to get another players' player controller
Widgets are always local. You'd just create two health bars, and assign each bar to one of the other players' pawns.
(Assuming the pawn is what contains the health value)
and how can i make a client to create a dedicated server so them can be in the map with their friends? (like a private match)
That's slightly beyond basic Unreal. That's backend server architecture work. You need something set up so that a user could cause you backend to start a server and then join it. Alternatively, if it's more of a creative mode, the player themselves could host that as a listenserver.
Essentially you need some online service that people connect to and have your server farm spin up a new instance for them
The idea behind it isn't that difficult, but it does require backend server knowledge. General idea is to have users have an ID or to use their Steam/Epic ID as their login maybe. Your Unreal game would have code that can interact with this backend to make requests and receive data. I haven't done anything like that in years but last I messed with that it was PHP /VB .NET territory. The implementation theory is very simple, the downside is cost. Running dedicated hardware is not cheap.
how can i make the client to host a listenserver? and what is the difference between listen server and dedicated server?
Listen server = client hosts, everyone gets kicked if their wifi goes down
Dedicated server = your server farm that you pay for hosts the game and clients connect to it
Listen server is just ?listen added on the open map URL, costs nothing, but only works for small cooperative games here cheating or being disconnected aren't problems
Dedicated servers requires source builds, hosting, some infrastructure, and are generally used for more competitive games with larger teams
and how other people join to that map?
Usually by clicking a "join" button on Steam after the host invites them
To give one example
Depends on your game though
can i use EOS?
Probably, if you can get your players to create an Epic account
No experience with that
and a listening server can be done on blueprints or i need c++ too?
Blueprint's fine, though any serious multiplayer work will definitely include C++ at some point
Even the most basic C++ can make multiplayerany project incredibly easier.
and how can i pass a variable trough dedicated server/listen server? i want to make a 1v1 game with cards and i want to get which number the other player choosed for compare the number and get the higher number or that can be done without pass it trough server?
For a 1v1 game, you probably don't want a dedicated server because the cost will be absurd, so listen server, and your question becomes a simple replication problem
Look up some tutorials
Is a listen server generally good enough for a 8-player coop game?
In the lines of Valheim (although that uses dedicated servers)
8 is kinda pushing it imho but if the game isn't too heavy it might work
Imho the main issue with 8 is that it's probably matchmade at this point
but you can replicate a variable and for show it on an hud you need to replicate the hud or replicate the variable for show it on hud?
You'd replicate the variable as part of the player state, for example
Tutorial stuff, go watch them π
fortnite creative is a listening server?
Unlikely
Assuming you are using widgets the hud isnβt going to be replicated. You would use a replicated variable and display that variable through the hud
ok thanks
Very interesting reading what you guys know, thanks for sharing! I generally want the option to host the server as a player (closes when the player quits, listen server right?) and dedicated server hosting. Havent dived too deeply into this yet, but are there any recommended frameworks designed for this purpose? π€
Imho if you have listen server support there's no point for dedi
The issue atm is that with my setup atm, the combat works when a listen server is simulating with multiple clients, but not without the listen server. So I guess Ive made it support that accidentally ππ€¦ββοΈ
Hey guys, Any idea how I can pause an online game for all connected clients without breaking replication? ( every thing goes out of sync), I tried pause game and slomo 0 and global time dilation 0, all breaks my game sadly
Dedicated servers are more annoying to support (need a way to update them since clients will automatically do so and be incompatible, need source build of the engine, need different UI, need to decide ho wto host them and how to pay... ) and so generally if your game works under listen servers, it's likely not worth it to go with dedi support and it'll be a big time sink for few players
I have an actor that has a function member that calls a bunch of RPCs server-side, I want all of those RPCs to finish and then I want to call SetReplicates(false) on the actor, is there a way to do that?
Yes, have some counter of RPC sent, and have the server replicate down a counter of RPCs received
Obviously after SetReplicates(false) your actor will have no way of reaching the server anymore, though, so that's a final thing
Some of those RPCs are engine calls though so I can't increase the counter there
Well maybe if I approach it differently, basically when my character dies I want it to stop replicating after some setup
Then as long as all of these RPCs are Reliable, you can simply send a final one that toggles a replicated FinalRPCReceived bool
If they're unreliable there's no credible solution
so I put that final bool RPC at the end of the RPC chain? I didn't know RPCs executed in order
Reliable RPCs do
Oh that's cool, then I'll do that, thanks
This applies to Reliable NetMulticast RPCs too right?
Those are from server to client so I'm not sure they concern you
But yes reliable = preserve order
Alright thanks
I've made a sliding animation, the server can do this fine, the client gains the sliding effect (no friction) but doesnt enter the animation, any tips?
SOLUTION
Since this i realised my "Start Crouching" & "Stop Crouching" events were not changing the variable required, so I linked them to the "Set Crouching variable"
this is on the animation BP
Hi, anyone know the best way to handle network failure? if the host leaves the game it doesn't destroy the session for the clients so it takes them back to the main menu but they then cant host or join another session, im working in BP atm
i figured it out nvm
Thanks alot for that insight, Stranger π
what is automatically replicated in ue4. im watching a tutorial and the guy said root motion is replicated automatically
Well, character pawns support it. That's about it
Is there a sdk or plugin for steam matchmaking?
Hey does anyone know what I should put in the repnotify function? It is to open a door...
Your action to open the door should do an RPC to the server. The RPC to the server would set only the OnRep boolean. In the OnRep function, you do the actions the door should take, such as actually opening up or closing.
that's what I DM'd yesterday lol
it gets weird with the engine cause of the way the door is programmed to spawn...
the things after "set w/notify" don't get magically called on the client
that's what the onrep is for
BP ReplicatedUsing is a member from hell though
how can i make a level streaming and save the level that the client changes on the server/api? (like fortnite creative when you create a map)
Hi everyone, I'm building a map for Unreal Tournament using the UTEditor and I'm trying to make a low-gravity area. for that, what I thought of is make 2 custom events in the player character that set the gravity (one decreases and the other one decreases it back to normal). what I'm currently doing is OnBeginOverlap of the trigger volume, i'm casting to the player character and calling the custom events. it works perfectly fine in editor, but when I package the map and play it on my server, the moment any player enters the volume, all clients (and possibly also the server?) crash. could anyone help me debug this? thanks a lot!
I have replicated property and I replicate that property using push models manually. just curious to know does this property wastes CPU cycles on each frame on the server or does it take CPU cycle after I mark it as dirty?
the replicator will only compare properties when they're explicitly marked dirty when using push model
?
@agile pendant I would start by making a savable world. But to do that you need to start making a creatable world in a way that you can serialize all of the data and restore it correctly. You question is extremely high level and that kind of thing requires multiple systems working together correctly.
I've got Issue. My multiplayer game works perfectly in pie, but if I'm using builded game and connecting to local host or other PC in LAN I'm experiencing huge langs.
I've tested creating&joining sessions in pie and it's working fine.
How can I fix that?
Any information would be appreciated - new to unreal engine, trying to replicate a character's head rotation, works as the server client (ofc) but client is receiving and updating movement, however as you can see in the print string the rotator is being set to the new rotation, then 0 0 0 again. Happy to send over the BPs if needed for feedback
Why not just get the BaseAimRotation Yaw?
I assume your rotating your capsule when you rotate the head and counter rotate the body to stay still right?
show the bp
You wanting the whole thing for head / body movement?
the relevant stuff
well for starters, you should never set variables in the animbp
the animbp should always pull those values from the pawn/character
what calls UpdateHeadRotation?
seems like that is running on server and client
that will not work..
I've followed a tutorial type deal for most of the head movement which included the BP variables, I wasn't aware about not setting variables in animBPs
anyway, it should be replicated by default
you should be able to use GetBaseAimRotation
and use the Yaw to determine where your looking
no need to replicate anything
Still mega new to all this, thanks for the information I'll try working on it from that, thanks
do it simple first
just 3 nodes
GetBaseAimRotation -> Set Head Rotation on AnimBP to it
2 nodes*
Ok looking good just from that change
So what's being replicated by default here?
Ah right, baseAimRotation is already replicated so by using that, each client already knows the values and is using that for head rotation got ya
Although it does still seem like the server is seeing more movement than the client?
did you turn on use control rotation
hmm this problem is kindof obnoxious to solve as a newer unreal user
and disable use rotation yaw on the pawn @autumn glen ?
is there something special that happens as a host for a listening server when you destroy its actor and restart its controller?
I had use rotation yaw disabled, but also had control rotation disabled
because as soon as my host gets destroyed and reset it the server stops reacting to things happening to replicating actors that are attached to the clients
if the host is no longer looking at the clients
Enabling control rotation now means that the client sees the server turn it's head along with its body, however the server cant see the client's body moving
as soon as you rotate the host camera to see them, it all works fine
rotate away it stops working again
@autumn glen that is weird, cause it works fine for me using that
hmm
@autumn glen this is client: http://thegames.dev/snaps/WkdUXSruLE.mp4
host on left looking and client rotating
ignore heads missing on clientside (PIE bug we got atm :P)
Yeah that's pretty much what I want - looks good. Could be an issue on my side due to something I may have changed in the blueprint or something
yeah i am not sure what else i can really say
apart from check your logic, but it should be simple
you do need to change the control rotation on all clients and server
else they will act weird
hmm i mean you could simply calc on server and send the transform through an interface to the bpa if you wanted to force it no?
like states
Will do - thanks for the help, after some tinkering if I have new issues I'll be back here anyways π
thats what I do for my upper body blocking
first is bpa
second is character
with a simple interface
set on the bpa
should be able to do exactly the same thing for head
and transform
pretty new to this aswell but that works fine client and server, just gotta move some logic to the client
I send the wanted state through a run on server event on client, check some stuff on the server then run the multicast event with the bpi message
"State" is exactly what you shouldn't Multicast :D
Anyone coming in later or hotjoining won't get the info on that
OnRep Variables are for State stuff
its just a custom int enum but you just aswell replicate the variable , but i'd still send the client input to the server through event
afaik servers dont get knowledge of onrep variables set on client
in this project the state is for telling the server if the player is trying to hold up its shield or not and also used in the bpa to activate upperbody slot blending
either way not sure why I got stuck on this issue
got my own problems with the host restarting thing...
but this riddle I cannot solve, what could make a restart somehow make line traces not generate hits on pawn capsules if server isnt looking at the traces or capsules?
is the capsule not reset to defaults if you destroy the entire actor and reset the controller?
or does it somehow change the server collision settings?
mm thats what i've been doing
for changing my wanted blocking state on server
but its unrelated to this anyway, im not having a problem with that atm
was just trying to assist
i mean is there a setting you can set that could make changes which connect that players view to which hits are being generated by traces?
the traces are running on the server
but the hits are not being generated
except when listening server looks in that direction
thats as far as i've been able to debug it
I can turn the hits on or off by simply rotating the server local player camera
@dim flameI've seen this before, it's something to do with not updating if not rendered
would the server player somehow get changed settings regarding that when character gets destroyed and controller restarted?
or is the server player somehow losing the active status of the clients?
omg
I wonder why its working before the player reset
but I found the solution
Visibility Based Anim Tick Option on the player mesh is not set to always tick pose and refresh bones, its just set to tick pose
but somehow that doesnt matter before restarting the server player, making it obnoxious
thanks
anyway that meant my linetrace sources werent moving
because they were attached to sockets on a seperate weapon actor attached to handsocket on pawn mesh
been stuck with this for a while

its set to default on new actors with new skeletal meshes
but I started this project building off third person template
hmm or maybe its default for actors inhereting from character
shrug
Is there any way I can, on the client side of things, say "I'm taking ownership of this actor now, and I don't care what the server does anymore"? I have a server controlled actor that I want to destroy but let the client keep purely during an animation
It's a magazine for a gun. I'm destroying it on the server and instantly replacing it with the new one, but I want to let the client keep it as a simulated object and/or hold it in their hands during an animation
keep them seperate maybe?
spawn a seperate version only on the client on destruction?
theres set owner but I havent used it
Set Owner
Is there a good way to verify you are making modifications to the correct game instance? I am holding variables in a game instance but when the client RPC calls it modifies it's own game instance and the server never modifies it's version of the game instance.
Game Instances are only accessible on the instance of the game it is running on. You cannot RPC to/from a Game Instance to Client/Server, and Servers do not have access to Client's Game Instances.
So how would I store variables/values onto game instance to keep to load after server travel?
Make sure you're running on server first, then do a Get Game Instance.
if the server itself is triggering the move, then you should be able to get into the server's copy of the game instance from there, before you're doing the move.
Okay so I canβt call rpc directly then. But I can have an rpc that when executing on server gets the values and modifies itβs game instance?
Thanks for the assistance I will give this a shot tomorrow!
Correct.
Anyone know why LAN (even localhost) has huge lags but pie doesn't have
?
I would guess it's not network related. Maybe loading? Check the logs for any errors or repeated spam.
Hello, I would like to ask if it is better to do a multiplayer game (I love mp games, I can't play sp), or do I prefer a sp game, I'm a beginner?
you def dont wanna end up in a situation were you havent designed for mp and want to add it later so
and i feel its easy to learn ineffective design when you dont have to think about mp
but do at your own pace
Hi there! I have a problem with broadcast. I create the dinamic multicast delegate:
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnHPChange, float, HPStat);
I Declarate him:
UPROPERTY(BlueprintAssignable, Category = "HealthComponent | EventsForBind")
FOnHPChange OnHPChangeBind;
And i call him:
void UKT_HealthComponent::BroadcastsHPAndSP_Implementation(const bool IsHPBroadcast)
{
OnHPChangeBind.Broadcast(Health);
}
But it is not called. My function listening to calls does not fire. What could be my problem?
I run in Play as Client mode
you either broadcast before you bind
or you are not binding to the broadcasting component, maybe to some other one?
@true grotto
I'm binding to Begin play, broadcast only after begin play
Character->HealthComponent->OnHPChangeBind.AddDynamic(this, &UKT_MainHUD_WD::UpdateHP);
For some reason, everything works when issuing UFUNCTION (NetMulticast, Relaible), but when it does HP incorrectly counting and I would like to avoid NetMulticast
that delegate will for sure not work across network
if you fire server-side it won't fire client-side
That is, I cannot run delegates on only one side?
in most cases health should be a replicated variable with onRep in which you call your delegate and then based on that you update your UI or whatever
they will run only on one side
@empty axle Ok, thanks for help)
hey guys, is there a delegate/overridable function somewhere that is called on the client when it's kicked from the server?
I only found a void ClientWasKicked(const FText& KickReason); inside APlayerController which is called on the client when kicked, but its body is literally empty, and it's not overridable
It's a Client function so you can override the virtual _Implementation part
oh really? didn't know that π
Another reason I don't like GENERATED_UCLASS_BODY is it hides those extra declarations from you, but also always makes them virtual even if you don't need them to be π«
yeah I had no idea actually, thanks for the tip!
so that's the only place where the client gets actually information of him being kicked, right?
It's fine actually, that function is all I need π
Bonus question: what happens when a player gets kicked out in real situations? I could only test in the editor at the moment, and there it simply ends the PIE session
it should open the startup map, correct?
Yeah they go to whatever the "Entry" map is by default
got it, thank you Jambax!
Do you mean replicator iterates but first checks it's dirty or not ?
I'm trying to pass custom USTRUCT as an network multicast RPC argument. It is okay on the server but on the client I've got zeroed member values.
Could you please point what is wrong? I'm not using custom serialization
Seems like there isn't default serialization in this case
So, am I right? π
What is in the struct?
Just bunch of other custom structs (non-USTRUCT). No UPROPERTYes inside
Yeah won't work then
okay, thank you for quick help!
They either need to be UPROPERTY() themselves, or you can use custom net serialization
I have a character, it has a function that is a Client RPC, I'm calling that RPC on the server, also when I call this RPC, on the next function I call I possess another character/pawn, but I have to put a delay to the possession, otherwise the client RPC isn't called at all, is there a way to go about fixing this? the Client RPC is part of the source code of UE4 so can't modify that
??? push model would be pretty useless if it still performed property comparisons
Maybe move the RPC call to OnPossess, or move the call on to the PlayerController instead of on the pawn/character?
Sadly that didn't work
It's likely that it's being rejected on the Client, since it would see that as a Client RPC on an object it doesn't own and would ignore it.
RPC's are sent instantly rather than waiting for end of frame so it's unlikely that the Server is rejecting it I would think.
It's a bit weird, because if I use a multicast instead of a client RPC, other clients have no issue with the RPC, only the client that is possessing a new pawn doesn't receive the RPC
Well Multicast doesn't require that the player owns that actor to execute it, whereas a Client RPC does
yeah but a multicast executes on every client except the client possessing a new pawn
Are you sure that actor exists on that client?
I.e. the client hasn't destroyed it locally, or it's not net relevant etc?
hmm let me check
ATM it sounds as if no RPC's are being executed on that actor, for that client
i'd start with the question "do i really have to send the client RPC there?"
what does it do?
It does seem risky to call a client RPC on an actor you're about to change ownership of
it's to stop all character abilities when it dies (GAS), and possess an spectator pawn on death too
so
it has no payload, its just a vanilla RPC call?
in which case, override AController::SetPawn, do GAS cleanup before you call Super
Well I'd have to check the plugin, I just gave a generalized example, because im calling AbilitySystemComponent->CancelAllAbilities and that should end all abilities on the server which should end them on clients, it ends the abilities on all clients but not on the client dying/possessing
I'll try this
it runs both on server and client btw, SetPawn
prior to super, your Pawn is still the old Pawn
Presumably it's not ending on the controlling client because of prediction maybe?
Not that familiar with GAS though
Should only need to call that Server-side unless I'm missing something
Oh I just noticed, when I possess the new pawn, the old pawn (at least the mesh) disappears
but it doesn't disappear on other clients
Yeah sounds like that client is destroying it locally
I'm printing a string on the Destroyed event, and it's called at the right time
same as other clients
maybe it is not network relevant for the client possessing the new pawn?
Possibly, but you would see the Destroyed call
and it wouldn't happen instantly, relevancy takes a few seconds
(by design)
Anybody ever experienced being in a steam dedicated server but the client not actually having any session info?
It's like i've joined the server and am in the map, but haven't joined the session itself.
Having to use open steam.##### console command to join, and I get into the session but have no session for NAME_GameSession
Digging throgh engine for a couple of hours and none the wiser currently as to where they actually join the session from automatically..
if you have a console available, you sure its not rogue piece of debug code that did something unspeakable?
like someone connected directly to server via IP
Anyone saw this? https://arrowinmyknee.com/2019/12/21/turning-in-place-in-ue/
I dont understand why it mentions about replication, cant we have locally deterministic turn in places?
This article tells you how to make a good turning in place motion in UE4, especially for a server-client environment.
I guess/hope there are better practices than this guide?
Multicasting for turn in place sounds weird
woudlnt you just make the client bpa play the animations depending on its local rotation?
Hi, how can i disable buttons on the clients lobby screen when the host clicks the start game button?
Create a replicated boolean that is set to "Rep W/ Notify" in the gamestate. In the OnRep function, have each local controller call their UI that has the button and disable the buttons.
When the host clicks the start button, set the boolean.
I'm just now getting into MP for the first time really, after several years of avoiding it, and I'm immediately running into an issue I don't quite understand.
I have a character actor, and a Tool actor. The character receives an input to Use the tool, and the tool then performs some local stuff for input queueing etc, followed by an event call marked with "Execute on Server" to actually perform the action.
The issue is that the event is never called on the server.. somehow. When spawning the tool actors, I do spawn them on the server by checking for authority. The tools are also owned by the same player controller that owned the pawn when they spawn (on begin play). The Tools are replicated.
I have confirmed that the event that's not being sent to the server is actually being called on the client.. so it's just not actually being replicated to the server
Are you getting any error/warnings in the log?
ohhhhkaaayyyy that's really cool, I figured it out.. sorta? I'd liek an explanation. When I create the tool, I was just passing owner into the spawn actor node in bp. I never actually called Set Owner because.. that's what I would assume was happening there?
Why does the owner argument (which as far as I know is just an interface for FSpawnActorParameters, same as c++) not actualyl set the net owner?
it even says in the tooltip that that's what it's for?
That value should be setting the owner. There's very few conditions that would stop that being set.
@mellow gate Worth asking. After setting the owner manually, you can RPC without any other changes?
Hm, it seems so yes, I'm able to use the tool more or less nromally
I am having some wierd behaviour with replicating what exactly the tool did, but I haven't done any work to make that work in mp yet
it animates and queues etc as expected
My guess would be that the "owner" doesn't exist before the object is being spawned if you're spawning it on beginplay somewhere. Passing in the owner should be sufficient on the spawn actor node.
Weird. If you care enough to find out why and you're working in an IDE, you could breakpoint SpawnActor in LevelActor, or SetOwner in Actor. Might tell you what is up.
this is ran on beginplay
On Beginplay of what?
Oh, sorry, the player character bp
The character may be getting created which fires the begin play before the player controller possess it.
Ah, so it may be unreliable to create the tools on beginplay
You can possibly do it OnPossess.
Ah, yeah makes sense
ok, well, I'm on my way again at least, this is gonna be interesting. Thanks for your help!
It's also worth noting that you can use Self for the owner as well.
that's what I tried at first, with the same result
mmm no need to get owner afaik
My testing confirms it - I spawned a replicating actor on Beginplay of the character on the server, but I couldn't RPC through the actor. Changed it to use Possessed, I could then RPC through it.
I've swapped it back to self now, and that works fine with the manual SetOwner
I had this problem with animation montages on begin play before I moved them
I'll give delaying the tool creation to OnPossess a try
It actually seems inconsistent now, at least on beginplay
does it work with a 5 second delay?
I think sometimes the playercontroller may possess the pawn before the beginplay runs on the pawn,. and sometimes it waits till after?
Beginplay isn't the best place to call most network things.
either way, waiting any amount of time, or until OnPossess will defs fix it
That makes sense yeah
beginplay is really wonky yes
This might be something to consider putting into the create default pawn code in GameMode too.
I've had issues with relying on OnPossess personally.
If this tool relies on the pawn, but only needs created once, it's best to have a pawn value on the tool you can set from controller's possession. Then just create the tool with the controller and leave it connected to the controller when trying to use it, test if pawn is valid, if not, try getting valid pawn from controller, if no, deny use. Otherwise you're looking at creating and throwing these away if you have respawnable pawns, or you're going to have netcode gating all of the time on possess/beginplay.
Ah, at the moment I'm just creating tools from beginplay for testing/learning purposes