#multiplayer
1 messages · Page 721 of 1
However, if you are expecting your player base to primarily host by listen server this would be useful
That's not the issue, I'm trying to avoid duplication
Is there some documentation out there on creating custom property specifiers?
for example, if you could have OnListenServerChange or something along those lines:
UPROPERTY(ReplicatedUsing = OnRep_TendiesUpdated, OnListenServerChange = OnRep_TendiesUpdated)
bool TendiesUpdated;
this would save you from having to have these OnRep calls all over the code base
I wouldn't specify it twice.
I would add a flag that makes the OnRep be called in c++ too
Read the second line!
Is CallOnRepInCPP some custom property specifier you would create
or are you talking about creating a completely separate variable to manage the state
If you wanted to not have to call it manually, then yeah.
This is what I am asking lol, is there any documentation out there on how to write a property specifer
Nope.
You'll have to find how to add it in the unreal header tool and then how that metadata is used in the engine.
You are prolly doing that on client, and GameState hasn't replicated yet. Add a small delay before that to see if it does the trick
Correct
That was it - thank you
APlayerController::PawnLeavingGame destroys the Pawn. Override it and make it not.
@fathom aspen thank you, this is exactly what I needed to know
What does this mean? AI controller controls NPCs, while PlayerController controls PCs
I mean, if the pawn is depossessed ,I want for an AI controller to possess it
Yes, I see no issue in doing that
For example, a player in an MMO who doesn't log out (properly) and so has an avatar just standing in the world
OK
there is no issue doing that if the Pawn knows how to execute all its actions, and the controllers just tell it what actions to execute, via input or behavior tree
if you put the Pawn specific logic in the Controller though, you're kinda screwed
True. Care needs to be taken that shared implementation isn't in one of the Controllers
How many game sessions x5.large can handle at once? (Gamelift)
Depends on your game
Hey guys I got an problem where to server and the client are not in sync, I fire an event and then the server is getting called immediately but the client is getting called around a half a second later. Does anyone knows how to fix this?
Here are some screenshots
In fast array serialization, does marking the entire array dirty (when elements are removed) necessarily mean replicating the entire thing from scratch? Or is there still some deltaing happening in the background?
I'm trying to figure out how hard I should work to stay away from removals
with removals you are safe with fast arrays
It always replicates deltas
Marking it dirty just means it'll do comparisons
Depends tbh, TArray removal is faster if you remove from the end
FastArray has quite a large header size for changes
we are speaking about bandwidth now?
yeah
ah oki
yeah tarray is depends ™️
x'D
but if you decide to netserialize your whole array and ignore deltas
it'd be better for the cpu, worse for bandwidth
but deltas will be in consideration anyways
Awesome, thanks 💪 quickly gets rid of paranoid virtual removal code
right, so random accesses with long arrays, fastarray better for bandwidth (in general)
short arrays... almost tarray wins always
yeah it really depends tbh, just have to make an educated decision on what one to use where
the more you know about how they work at the base level the easier it is to decide
rule of thumbing this is really tricky................
but I guess with a series of rules and your budget needs you can decide
any fast array change for e.g. is a minimum 128 bits
when we say short, how short are we talking element count-ish?
- 32 bits for each altered or deleted index
also depends how well the items serialize etc. By default in 5.0 per-element delta serialization is done with FastArray now, but previously that wasn't the case
So if you have an array of fixed size where only the elements are changing , TArray (or static array) is better
Certainly used to be the case anyway. The general answer is just "it depends" as always 😄
we should have an array type that ughmm yeah i dont know what im saying
🤣
it's hard to tell
as Dev told me once, tools in your toolset, sometimes you can unscrew screws with the wrong screwdriver
profiling gives the solution for your use case always
Hello, I'm trying to blend to Level Sequence camera in a multiplayer setup.
The Player Controller blends correctly and the sequence is played, but I'm not blended into the sequencer's Camera Actor, but in the Level Sequence Actor itself.
In the single player setup, setting the view target to the Level Sequence always automatically blends into the camera. It doesn't work like that in the multiplayer?
I'm getting crashes when hosting a session then accepting an invite to another session. Is it essential to destroy any existing sessions before joining another?
How can I play an interface on the server?
Define "play an interface"
I made a flashbang with an interface which makes the character get flashed with a widget
If the character is in the range of the flashbang
But it doesnt work for the server
only clients
However it spawns the projectile
Here's the spawning part of the code
Why would you want to run it on the server, though? If it's just a widget and/or some VFX then it should only be called on the client(s).
Cus it doesnt work
You need to initiate it on the server, but run it on the clients. For example with the "multicast" event.
Where is this snippet being called from?
The flashbang itself
Right so it's a separate projectile spawned on the server that then runs code when exploding?
Yeah
Is this a dedicated server (pressing Run as Client) when playing or a listen server?
Have you tried seeing if the trace even runs?
Before thinking about the interface
No but have you verified via a log or whatever that it's getting as far as the interface func call on the server?
You can log for client and server separately to see
Important to nail down exactly how far it is getting on the server before assuming it's the interface
It may not be calling that entire chunk of logic
Hey guys I got an problem where to server and the client are not in sync, I fire an event and then the server is getting called immediately but the client is getting called around a half a second later. Does anyone knows how to fix this?
here are some screenshots
You cannot fix it, this is how it works. 🙂 You have to work around it.
A safe option is to use RepNotify variables: https://docs.unrealengine.com/4.27/en-US/Resources/ContentExamples/Networking/1_4/
Welcome to latency 😅
the way to sync it is by sending a timestamp
basically
u do action locally, tell the server to do it with your timestamp
once the action arrives to the server
the server can know when you started issuing the action
the server can validate such action
if everything is nominal
it will proceed to fast forward the action to the point where it should be based on current time and timestamp
if a hazard is found the server issues a rollback to the client
But sending a timestamp is possible only from a Net Owning Client, right?
yes your local timestamp
usually you'd like to have a synced clock
in vanilla UE4 is getservertime
or sm on the likes in the gamestate
it's not very good
in fact I recommend implementing your own ntp clock
NTP?
network time protocol
ok
Does anyone have any clue why a root motion anim montage would shake or glitch the animation without applying the movement? This only happens in multiplayer mode. The animations have enabled root motion and the animation bp is set to accept root motion from montage. Not sure what I am missing
Riddle me this batman:
I make 7 calls on my server to RPC on my client. I confirm that the call is going out to 7 different actor components. All actor components have the same owner and are the same class, created in a batch earlier. Only the first actor component runs the code, the rest do not. No message log errors indicating that the code hit an error
Am I missing something about how this should work?
event dispatcher allows you to make a single call that splits into multiple simultaneous events
should be what you need
It would still be blocking so the UI and current level would freeze.
fuck it nevermind
I'm not 100% sure on the answer since I don't know how you're doing things and I'm no expert myself
disregard my info if it's not a simple answer like not knowing about event dispatchers
Late joining clients will automatically call all OnRep functions that differ from the default values of OnRep variables, correct?
Hello, I'm currently implementing a system to add niagara particles to any item I can pick up. I also want to make any upgraded sword or similar have particles as well.
So far, I've gotten to the point where the server spawns the particle systems, but I still gotta get it to the client, which brings me to my question...
I'd assume these weapon particles are spawned on the server then I need to somewhere have a multicast event which spawns them on the client?
I'm still quite clueless on how these systems are implemented in multiplayer. Any guidance or advice would be greatly appreciated!
Just have a niagara component on the pickup actor itself and have it activate the particles on both client and server when spawned
No need for any replication here
Hi thanks for your response, I just tried using a repnotify it still doesnt work.
Where do you add new players and lookup to check if they've been on before? GameState? GameMode? On the player, when the player calls begin play?
I'm not at my computer but Game mode I think. Search for Login in the header there's some useful functions to override.
I don't think that works for me. I might be understanding this wrong, but the controller doesn't necessarily own the items that are on the ground.
Yeah, I just tested it by getting ownership during runtime and the moment the playercontroller is the owner of the item that's on the ground, then it works, but also only for that particular client. So, I need the server to distribute the particle systems I guess?
Ownership doesn't matter in this case. A pickup is its own thing (regardless of owner) and FX exists on THAT
So if the pickup actor is replicated and you activate the FX on BeginPlay, it'll play on both client and server without having to specifically call a multicast RPC or whatever
but it doesn't work, so somethings not right
Ok so you have a pickup actor and on beginplay you are spawning the FX right?
In that case if the pickup actor is replicated, both server and client will see the FX playing
I implemented a very complex system from an ARPG plugin that does a bunch of things, so it's a bit hard to pinpoint stuff
I'm still quite clueless on how these systems are implemented in multiplayer. and I implemented a very complex system from an ARPG plugin that does a bunch of things don't get along great: I suggest simple examples to learn how things work
I know this is under NDA mostly, but how do people test online multiplayer on consoles before release?
I get that you can use steam etc. for pc, but otherwise I would need 2 devkits then or what is the common approach?
Basically, I have a BP_MainPickupClass which has a BP_PickupComponent as well as a BP_ParticleService (which is also an actor component). The pickup one handles setting which system to spawn and where, the ParticleService takes those two variables and spawns on Server.
At BeginPlay in the BP_MainPickupClass calls a custom event called initialize within the BP_PickupComponent which down the line calls an event called setParticleSystem which sets which systems and location. This same function calls an event in the BP_ParticleService with those variables as input. That event is the Server_SpawnParticleSystem (On Server). This is hard to explain, does that make sense tho? @grizzled stirrup
Ok if you are initing data on the server then yes it'll need to replicate down to clients either as an OnRep variable (a custom struct if initing pickup data) or as a multicast RPC for one off FX
I personally have a system where I have a DataAsset per pickup type that gets replicated down as part of a struct with a few other properties like Cost and such that gets calculated at runtime
So you can then activate the FX on the client when that struct OnRep function calls
I have that replicated variable, but not sure what to do with it
OnRep it just does this again
This system is almost the exact same from how the plugin set it up
Is there a different variable that I'd need to RepNotify or is that RepParticleSystems variable what I'm looking for?
Honestly I'm not sure this does seem like a very complicated setup
In general the GameplayAbility stuff is just very convuluted in my opinion
I would just have a simple pickup that gets initialized by a simple struct, that structs replicates down via an OnRep variable
I mostly tried to implement it as practice to figure out how this stuff works properly. I've never worked with structures or datatables before so I already learnt a ton, it's just this last bit that doesn't quite make sense to me on how to tackle it.
It looks clean from what you've done but when that struct replicates you then set another struct
When does the FX actually trigger?
Here I guess
That server event near the end
Right but it seems SetParticleSystem is only called on the server at begin play is that correct?
Gonna check real quick
So the client would never call it when it receives RepParticleSystems as BeginPlay has already fired
Ok so yeah the client will never call SetParticleSystem as far as I can see
Because stuff will replicate down after it has already been called most likely
Hmm, sounds like that could be whats causing it, but no clue how to fix it tbh
Simply call SetParticleSystem in the OnRep func
In here?
Yes! Particles have replicated down on the client, the client knows what to play, play the FX!
I added it, but hasn't changed anything as far as I can tell. It might be the way I set up the events in the particleservice.
I was trying some stuff out, gimme a sec
Oh right because you aren't actually playing the FX in that function, you are calling a server RPC to call them
Basically it boils down to client recieves OnRep variable with particle info, plays the particles locally
Also you'd want to be calling that AFTER you set the struct and replicated var if that struct you are setting is used within the play FX function
Changed it
Idk if this helps, I tried a few different arrangements non worked lol
This part with the whole RPC stuff, I just can't wrap my head around it, it seems 😄
Do I need to add a repnotify variable here maybe?
In theory what is happening here is the client is telling the server to then go back and tell the client to spawn a particle system at a specific location
Unless something else is calling the server RPC?
Client RPCs are only called on the owning client
So if you want ALL players to see it or if the client doesn't own this actor, then use a multicast RPC
The server_spawn function is only called in the setparticlesystem function
Ok so the pickup itself doesn't need to call a server RPC if it's happening at begin play
Begin play fires on both client and server so you can use the Switch has authority node to filter between server and client
That cancels out the need for the server RPC
however if the client does not own this actor, the client RPC will do nothing
However... it looks like it's actually a multicast RPC as it says replicated to ALL
So you named it Client but it is a multicast
Would be so nice if I could jump over this hurdle today which would finish this system implementation for now. Spent 15 hours on the whole thing today and want to finish it lol
I would heavily suggest working on a simpler example just to get comfortable with what gets called where, it seems you have a complicated setup but aren't quite sure how it works
Yeah, would definitely be smart, but I usually bruteforce my way through things like this. At first I had no clue how this particular system worked, but now I get it mostly. Just took a lot of effort and now I can very comfortably add any kind of particle system to any of the pickups (and hopefully the equipment soon as well)
Just this last bit is halting progress
Hmm, basically the issue right now is that I'm not able to see anything if the client doesn't own the pickup item.
Which usually works if you multicast right?
How should I be storing whether a weapon skin is unlocked/locked
your server should be concious of the progress of all of your players
so can do through a DB, or through a save
keyboard input is not working on client
any idea
player movement is working fine offline but when it connects to server there is input at all
Show your setup
Should I read this as "runs on client ONLY" or as "runs on both server and owning client"?
This is a function that you are calling from the server and its running on the client that owns the actor, it doesn't execute on the server
Server triggers it, client that owns the actor runs it.
@dark edge
Dr. Evil — Today at 1:11 PM
Riddle me this batman:
I make 7 calls on my server to RPC on my client. I confirm that the call is going out to 7 different actor components. All actor components have the same owner and are the same class, created in a batch earlier. The call is made inside an actor (player state) that is owned by the client. Only the first actor component runs the code, the rest do not. No message log errors indicating that the code hit an error
Am I missing something about how this should work?
Show your setup
rgr. one moment
the print leading to the call is printed 9 times
but the client only runs to code directed at it for the first instance
(each call is made on a separate object)
What happens if you make it reliable?
This sounds like a weird approach to whatever you're doing. Why can't you just do one RPC?
This sounds like it should be a RepNotify, how big are the chunk struct arrays?
Will EventActorBeginOverlap fire on all clients no matter how far away they are? Or should you use a multicast for it?
Is it still possible to create a replicated UObject in UE4.27? I tried to follow this tutorial:
https://jambax.co.uk/replicating-uobjects/
But it doesn't work for me. I want to call an UObject's RPC and its dropped, the function is not executed on client, nor server
That will fire if the actor exists. On some clients, it'll be out of relevency range.
What's best practice for begin overlap causing destruction of certain actor's components?
Would it be a simple mutlicast -> destroy component
or a rep notify with a variable to disable it?
If the component is replicated just destroy it
Doesn't seem to work. I'm turning off a light in an actor.
Hold on, let me set the actor to replicate.
Ok, so destroying components works but changing materials doesn't, even with replicates component. Is this how it's intended to work?
Material isn't automagically replicated, just replicate some thing that drives the material. What are you trying to do, just turn a light on and off?
Use repnotify for that
Yes, destroying the light component is working perfectly. I'm using multicast to change the material and play a sound.
Then how do you turn it on? Don't destroy the component, just turn it off.
What's the actual mechanic you're trying to do? This sounds like it could just be driven by a repnotify on a bool...
No need to.
Lights turn off as soon as a pawn steps into a triggerbox
fire and forget is fine, no need to turn it back on
as well as changing the lamp's material to off and playing a sound.
Just make a variable bIsActivated, repnotify on it, and do all 3 of those things at once when it changes.
don't even need to replicated the components then.
The logic is working btw.
If you want to optimize it further you can replace the cast to Smiler_BP with a check for a tag instead. Actor Has Tag “YourTagHere”, true / false. @shell forum
Are tags really faster than cast to?
Casting keeps the objects in memory
So it’s not like a faster vs slower thing it’s like how much complexity your game can have at any point in time
Got it, will do.
Which object does it keep in memory? Only the successfully casted one or all of them?
The thing you successfully casted to AND all of the things it references too.
I might add some functionality like playing an animation with the pawn that walked there so will leave it for now.
So for instance in my game I have a few different parent character classes with even more child classes underneath them. Instead of casting them which would be expensive for memory I use tags.
The downside to using tags is that they are prone to human errors with typos and can be frustrating when debugging. You have to make sure that you spell the tag exactly the same when checking for it. They’re also case sensitive I believe.
Correct
My game currently doesn’t have players joining in late for any functionality. Would using a multi cast still apply changes to actors out of the range of clients?
Nope. Multicasts don't count for out of range clients as well as for late joiners. They should only be used for non-stateful events, aka transient events.
See first pinned message. The blog explains it very well.
@shell forumYou should prefer RepNotify when it makes sense, it's really elegant and robust.
Depends on if it's a state or not
if it's stateful, the variable isn't useless
Use a bitmask then
I mean how many states does your thing really have?
That does not justify not using them. Their use is just inevitable.
if this is in blueprint, you don't really have a replication callback there, its a property changed callback masquerading as one
so if a client sets a value on RepNotify variable, OnRep will trigger
blueprint OnReps will trigger on any value change
no matter if it was made through replication, or if the client set the value locally
Also as Adriel told you, try to replicate the thing that drives the action, not the action itself
That can save you bandwith
There's nothing special about RepNotifys really. You set the value on server and you get notified of the new value on both server and clients(in cpp it's only on clients)
Sorry if this doesn't make sense bur doez anybody have any advice about learning how to optimize data transmission for better multiplayer performance? Complete beginner. I know data types have different sizes but confused how this works in practice. Does this apply only to the parameter data types passed in to functions, or also how these are used in the receiving end?
Omg someone please help! Im trying to Spawn Sound Attached on an Actor in the Level, but no matter what it will not spawn. I've tried events as Server, Multi, Owning and no Replication. Is there something I'm missing for in level actors?
Fixed Actually I did not set Input mode
What in the world have you assaulted my eyes with?
ikr
Hey guys, what would be the proper way for the server to move a client? I have a vault system where the server sets actor location in a lerp towards the target location but the client receiving the location updates is very stuttery
Hey I was running experiments lol
Either way I got it figured out lol
Sounds like it might be good to have a local character that requests from the server if it is allowed to do the action, then the server runs it and also triggers the action on the local character. So, two things are basically happening.
-
The server checks if the client is allowed to do the action, then does the action on server and tells the local character if it can do that action.
-
The local character requests to do the action and on request granted it performs the action locally with smooth client side movement.
I'm a noob at multiplayer so I could be way off, please feel free to correct me if any of this is wrong! 😄
gameplay task component with root motion animation
that is basically what it is right now just the act of "allowing" it i am not sure of, because moving the actor (player) locally the character movement component always works against it
which is why i am lerping the character location on the server to let the server have authority over the players location
i guess all i need to do is to start the same lerp on the client instead of waiting for the server updates to get smooth movement - I was just wondering if that was the correct way of handeling it or if there is like a "CharacterMoveTo" function that then takes care of the client side movement natively with the character movement component before I implement it myself
due to the way our setup works we do not want to work with root motion animation - we want the code side (distances, speed, possible heights etc) to be solved in code instead of the anim
distance and height would be code driven
root motion often is, it can take a float curve for height during the animation, for example
we use that method for jetpack jumps
oh okay that sounds fair then, is there any references you could recommend to get into?
i did not write it, so i can't tell you much off the top of my head
but it handles predicted movement well
no jitter involved
it's always one thing to have it solved generally but multiplayer always makes it harder and rarly a tutorial covers that part ^^
for documentation on this, i'd dig into GAS
you don't need to use GAS to use GameplayTasks, but GAS does use them extensively
thanks - I'll dig into this to start out with then 🙂
https://www.youtube.com/watch?v=YvXvWa6vbAA
This week on Inside Unreal, Technical Writer Michael Prinke will guide us through a tour of the Gameplay Ability System! We'll set up Graystone from Paragon with a couple of gameplay abilities in the Third-Person template.
ANNOUNCEMENT POST (contains project files and resources)
https://forums.unrealengine.com/unreal-engine/events/1850699
TRAN...
anyone have a method to using "Launch Character" in multiplayer? ive seen online in old forums that it doesnt work and it seems to still not work with multiplayer is ue5
any tips?
is there anyway that I can track how much data server is getting/sending or in another word how expensive is networking in every session?
there is a net profiler that comes with unreal
sorry I conked out, I've done it via rep-notify before, but I'm redoing it and decided to try not doing it rep notify
I don't mind re-working it to be rep notify at all, I'm just curious what's happening because for sure there's seems to be a "rule" happening here
chunks are right now 100 structs with a vector and a string in them
you are right that checking it as reliable causes it to work properly
Until somebody joins late
Persistent state should always be driven by replicated properties
if you're talking to me, this is client side display
so that's not super important
I'm horribly abusing the unreal engine to make a tile based game
replicating the actors isn't viable with the numbers involved, so the server provides a struct that tells the client what it needs to display on each tile
in the past I did it via repnotify for the 100 struct array
but I was trying to see if I could refine that so I'm not updating 100tiles every time a single tile changes
honestly, probably over-optimizing
and it's definitely something I can do post-prototyping if it's an issue
but!
I learned something about RPCs and reliability :)
You wouldn't replicate 100 tiles everytime it changes anyway, arrays and structs only replicate their changes, not the full array
The problem with RPC's is if the client doesn't have that actor when you send them, you'll never see the changes
Looking at the GameSession code, it seems that BanPlayer, simply kicks the player?
Any googling tells me that it still doesn't actually ban a player, I thought I would ask here, just to confirm?
And if it's the case, does anyone have a proper way to ban a player?
Or would the solution simply be, to use PostLogin or something, to identify the player, and if they exist in the ban list, to kick them again?
ok, that's pretty reassuring, however is there any way to know what the changes are? If I have 100 structs in an array and a single struct is changed, is there a way I can know which struct was that changed? I'm not sure how rough running the setup code for 100 tiles would be if I did it every time a change was made, without having fully planned out that far I'm not sure if small frequent changes to the array would cause issues client side in that sense.
I can plan to do batches instead of smaller updates where possible, but it'd be nice to know how much flexibility I do/don't have
That's not an issue for what I'm doing here at least, these are actors that are created on startup immediately. Without them you'd see a blank skybox. The client tells the server when it needs to update the display based on where it is in the world. The issue is the scale of possibly displayed things goes well past the point where actors start to butcher performance, my tests are on 10,000 tiles so far. So the persistent state is the structs that tell the visual tiles what to represent. In a sense I'm re-coding relevancy to a degree because of the actor performance issues.
So long as I wait for the player to properly log in, those actors have to exist or everything is already fuxxed lol. Definitely keeping that in mind going forward though.
In Blueprint no - but in C++ you can use a RepNotify and compare with the previous sate, or you can use an FFastArraySerializer which has per-item callbacks.
ok, I'll file that away for the future :) I'm trying to take this as far as possible with blueprints. Injury makes typing code for long times start to cause a lot of pain, I find blueprints easier to work with.
but now I know there's a C++ backup I can go to if I really need the performance
anyway, awesome help @chrome bay, super appreciate it!
So how do you go about saving information for a dedicated server, like so the player logs out and back in they are still in the same place with the same stats and stuff and not just starting over again. I know there is the saved game object but for multiplayer I am not sure where to start saving that kind of info.
you'd store the relevant information in an actor component (probably a game state child?) and add code so when a player logs in they have an ID that lets you know which stored component represents them. Super unsafe way to do that would be a String map that ties player name to their actor component.
Then you load their location/stats/etc from said component. If they don't have an object saved under their ID, make one and start them off from scratch
Hadn't considered using their ID's to get it like that, I've got their ID's stored so thats not a bad way of going about it, thanks!
good luck :)
One more thing, if I were to store it that way, would the info be saved if the server were to shut down for any reason? Like is game state persistent even if it goes offline?
I don't see why you wouldn't use the save game object. Just need to have some unique identifier.
Login - server checks if that save game exists, if it does, loads it and sends that information to the player.
Logout - server creates the save game with the relevant information.
How can i set for attached weapon "Only Owner See", on client it works, but when server pick up weapon then client see this weapon
I mean, if you set it up to save properly, just like you would save for a single player game.
I want hide weapon for others players
I want only owner see
So, how it should looks like?
If I were to assign a UUID to every new player, and that UUID will save to lets say your steam account, how would I go about that?
Why not just use the Steam ID?
But lets say I wasn’t using steam sessions, what would I do
Idk if ima get a steam app cuz its $100 and like breh
game using steam uses the steam ID as unique net ID
in the playerstate, by default
Yeah but what would I do if I wasn’t usibg steam
other services have other ways ot determining what unique net ID is
and if you don't have at least 20-30 people in studio, you do not want to even consider crossplay
True
Do u know any other service there are other than steam
One that doesn’t cost $100 lol
I’ll check it out, thanks
How true is that for the simplest of online functionality? Nothing crazy, just joining friends? Does it really get into the weeds if you use EOS as backend?
the console folks are really fidgety about keeping their standards
and when you patch anything it has to pass their QA for every console
and you have to time all patches for all platforms together
its a real pain in the arse
Would PC first with EOS be a good foundation? I realize console is a stretch but I'd like to keep the possibility open in the future.
epic store requires crossplay on PC to work iirc
but not consoles
which is a far shorter order
If we do console at all I'd want crossplay as default, I'm a big fan of crossplay and would rather not release on consoles than have a fractured population. This is all spitballing, it's one of them good problems to have.
our console release will (hopefully) be 18 months after the steam release
how do i ensure that a replicated variable is replicated down to a new client, before the new client's actor calls its begin play?
example)
client1/server change a ball from red->blue
client2 joins the new server and on the balls begin play updates itself using a replicated variable "color"
client2's ball doesn't change color
it always does
when client receives instructions to spawn a replicated actor
it first spawns the actor, then sets the replicated variables that are sent in the game package, then calls OnReps, then PostNetInit, then BeginPlay
i see okay maybe im doing something wrong then ty @winged badger
i am not entirely sure that applies for replicated variables in ActorComponents, or in Bleuprints
as Blueprints don't have a replication callback
C++ does?
it does, in Blueprint they masquerade the PropertyChangedEvent as RepNotify
you can easily test it by setting a value of replicated variable locally on client and then watching its OnRep fire
Is PropertyChangedEvent a first-class thing or just some BP hackery?
aww we don't have an automagic property changed listener in C++?
Isn't event handle starting new player also supposed to be called after a seamless server travel?
I kind of only get the event fire for 1 out of 2 travelers (I believe its the server )
it is, and it does
Hm
Hey all. Quick noob question. If I have a lobby-specific player controller, when I do server travel and load a new level, if that level has a different default player controller, will it switch over or will this cause issues?
Is it expected that movement should be always reliable or not?
Depends on what you mean by "movement"
movement input shouldn't be reliable, you're sending it constantly
Basic movement, movement like dodge etc.. But alright got it, though so, still learning.
I need some help, clients are jittering so much but it is replicated correctly, bcuz its the default character replication
We need way more information than that. What are you trying to do, are you doing anything outside of walking around and jumping?
Yes
Its a true first person camera
It’s probably something to do with that
Are you doing any sort of wall running or dodge or dash?
If so you'll probably need to extend the character movement component to use compressed flags over the network.
@fluid horizon
Nah
Are you simulating some network lag and or packet loss?
@fluid horizonWhat about sprinting? Are you doing anything movement-wise that's not just a change in the default numbers on the CMC?
If you try to sprint by simply changing maxwalkspeed, you'd get that behaviour.
You have to do some cpp stuff in the character movement component to get proper replicated sprinting.
you don't need to do that in cpp. you can easily just do it in BP
Set sprint speed on the client, and on the server
Technically yes. But it tends to fall apart on high ping.
I've experienced it before and I had to use cpp. There was movement lag on high pings but I wasn't rubberbanding
Always test multiplayer with at least some simulated lag and packet loss. Otherwise you're just lying to yourself.
That doesn't really make sense to me. The movement speed is set on one frame, not continuously.
Nope, it's set on one frame on the client and a completely different frame on the server.
Which results in at least some amount of time where the client thinks it should be moving faster than the server allows.
The solution to that is to either:
- not set speed predictively (ie wait for server response), but this results in input lag
- use saved moves (or a similar system) to reconcile client prediction with the server.
Additionally, running your game with simulated lag and packet loss will expose these kinds of issues if you opt for a blueprint only approach.
but that would still resolve itself in a matter of a few ms in most cases wouldn't it?
they're saying that the client is jittery is likely an ongoing problem because they haven't set the max walk speed on the client & on the server
I have mine set to 72min and 150max with 1% packet loss for both incoming and outgoing traffic. You can configure this via Editor Preferences ---> (search for network) then look for the Multiplayer Options and Enable Network Emulation.
thanks for the input here. I'm going to have to test this out myself
If you have jitter without simulated lag, its gonna be much worse with a little bit of simulated lag
You can also use p.NetShowCorrections 1 in the console to have it draw whenever there's a network correction. Ideally when simulating lag you want there to be nothing drawn, but a little bit here and there isn't so bad. If you see lots of blue capsules something is wrong.
Nope, just normal movement
Any way to prevent the stand alone server console from closing immediately after spurting out very useful red errors that I want to read?
I'm using simple On Component Begin Overlap and it triggers on all clients while I can't see option to turn it to run on server only so the client don't have to bother with this event, how can I do so? (Each client have capsule overlap collider in its Blueprint)
SwitchHasAuthority right after OnComponentBeginOverlap and use Authoirty pin
Launch with -log flag
Is SwitchHasAuthority done locally or is there a network call? Is it lightweight enough to call many times without trying to be conservative with it?
basically, I'm using a thirdpersoncharacter but made it true first person, its prob something to do with that
The camera follows the character animation
I chose head as the parent socket, and it only jitters when im walking backwards
Yes. It's a macro that calls HasAuthority() which is a one liner function really
I knew about that but the problem is that I would like to make client completely ignore this event, because it will literally just get blank triggered for no reason at all
You would need to modify the source code to do such a thing. And if you do it, it might break some engine functionality down the line
It's a micro optimization really
does RPC work with return values? like if i have a Server RPC that returns some type and call it on the client, will the client get the proper return value? or will it just be the default of the return type?
Rpcs can't have return values.
If you wanna return a value you need to call a second rpc to send the response back.
oh thanks i didnt know this
it's an if, so no rpc's implied
it just reads the Role from the Actor
note that client has Authority over Actors it spawned itself
so do not confuse HasAuthority for IsServer
its not the same
not really a #multiplayer issue, and definitely not the best channel to ask
probably, but i have no idea how
i mean you can get code to compile for server only with #if UE_SERVER
no
but i would use the preprocessor diurective in c++
to instantiate a blueprint with server only code only on server
and i wouldn't even package it on clients
so you get the same effect
not sure if UE_SERVER is correct, but its something to that effect
your intellisense will probably figure that out
you can also use GameMode, as clients won't really have that one
but you would need to package the server only blueprint code that way
Could anyone tell me, why if I use PlayMontage, I need to pass it through RunOnServer and Multicast, but if reguar animation is used through StateMachine, only RunOnServer is needed (Multicast is not required)?
Is there something under that I'm missing or some kind of integration by building project out of Template?
I'm so confused, each player has a cylinder overlap collision around him and when other player enters it, this player will be added to the array. But why on client its adding itself to this array?
Also when I use branch so that Other actor is not equal to self reference it won't add anybody to this array, what I can't understand
its a component collision, Actors don't have a form or location if not from their components
if your collider can trigger an overlap with another component on the same Actor, it will
Probably would fit better in #epic-online-services , but the answer is no. EOS does not host dedicated servers for you, that would be an insane large cost for them. Unless you're referring to perhaps matchmaking / server discoverability. Then maybe? I see some resources about EOS + Dedicated Servers but can't quite figure it out quickly.
is it normal that if i add even something like 30 to pkg lag command my attack traces just dont work or they work very poorly?
should i execute the traces on clients? how can i trust client traces tho?
if you don't, any FPS game will feel not responsive enough
you do sanity checks on server when you get the client's trace result
The problem in this case is that the client sees a different view of the world than the server or yet another client does because of latency. What happens is that while a character on your screen seems like it's in a certain position it may have already moved on the server and hasn't been changed on that client yet. So if you shoot at a target on your client and the server does the same thing whenever the 'shoot packet' arrives the server may say that the shot missed because the target mean while moved.
how can i trust client traces tho?
If this is a Player vs. Player game then the answer is you can't. The client could obviously could just say "I hit this person!" while maybe being miles away. A solution to that is for example rewinding characters/physic objects etc. to compensate for the latency, but I must say I've heard people having a lot of issues with this because of the way Unreal's physics engine works. Although I'm pretty curious how that is now in UE5 because of the "async physics tick" system. But regardless it's still quite the setup.
What I believe Zlo said is the more common way. To do sanity checks, e.g. "is the character behind a wall when it was shot?" or "was the shooter facing roughly the direction of the target?" etc. but this obviously still has the issue that not all shots will be valid when they should have been. It's however a lot simpler.
A point someone else has brought up before which I couldn't agree more with is, first try to make your game actually feel good and if you can prevent cheats that's cool. But if no one plays your game and you spend all this time trying to make it cheat proof then there was no point in doing it in the first place.
If your game does grow big you can always hire people to fix these kind of issues or at least reduce them 😛
i totally understand the issue and i appreciate the detail explanation to begin with
this is a melee project so i guess making the "sanity checks" would be much easier
i also agree on the last part, people are going to cheat anyway and its not like i have a studio behind me to deal with it
For what my opinion from a random person on the internet is worth, I would not spend all the effort on trying to make it fully cheat proof and rather instead just do some sanity checks yeah 🙂
👍
Hey guys, I recently got into unreal engine and I'm trying host a multiplayer game in aws. I haven't done this before, so I'm kinda skeptical.
Anyone tried dedicated servers before?
Yes, many, many people have 🙂
You need to build engine from source, make a server package (I'd suggest Linux), and come up with a deployment method for getting the package onto a VM.
I use Packer to make an AMI that I create VM instances from.
Quite a lot of work, and that's only scratching the surface really.
And if you don't want to have to connect via IP address, you're going to need to setup an #online-subsystems too (e.g. Steam or EOS)
Do you mean like this? Because the server console still closes immediately upon erroring :/
if you want to read the error and why it crashes, just open the logs files 😉 they are under Saved/Logs usually, named like your project and suffixed with a number IIRC, just check the recent logs and you get the pattern.
This should prolly do the trick, though I launch using the commandline
I can't seem to find the Standalone Server's log, argh
should be in the same folder as the editor logs
Scratch that, found it, that works!
^^
Thanks for the help! 😍
thanks mate!
Hi all,
Not sure what I changed recently, but all of a sudden, when I PIE, the client does not spawn the pawn anymore that is set in the game mode. The server does of course and when I run two standalone experiences, they both work as well.
How can this be?
And I don't have any custom spawn logic. I literally mean the case of pressing play in a level where there is a game mode override with a pawn set
Hi Everyone, I am fairly new to Unreal and I created a modular character creator for a multi player game I am putting together. I have the character creator finished but I want set it up to save your character to a character section screen and when selected you can load him into the game. Is there any tutorials or documentation to do this?
Hi, TopDown situation here. When I press movement for either Server or Client, I can see movement on both sides. The issue is when ever (after the Release tirgger) the Client character is supposed to stop at the end (finish movement to location), it does stop, but right at the end when it goes to the location, it jumps back for milisecond and then jumps back to the initial location. I think it's something related with Server forcing to move character to it's position but right at the end client finishes the movement? I did move MoveToHitLocation node after SR node, but the result is the same in both cases either if that node is executed before or after. I'm not sure what causes this.
Ignore tutorials, but you need 2 things.
-
Some way to define your custom character data as a struct (the "recipe" for the custom character) with the corrosponding functions to go struct -> character and character -> struct
-
Save game, where you just save the struct to disk.
Once you have the struct definition of the character, it's trivial to also pass it over to the server so it has it and can build your character for you.
@dark edgeTrying to make multi player like a conan exiles dedicated server
K well you'll at a minimum need to be able to save a players data, look up savegames.
@dark edgeYou got a link to a good one?
With my name, you really think I'm gonna recommend any tutorial videos? Just read up on how save games work. It's just a wrapper for some structs that you can save to disk. You need to be able to condense all the info about a player (their inventory, their custom character data, whatever else) to some structs and just save/load them with the savegame system.
@undone galleonThis should get you started but make sure you understand what you're doing and not just following along.
https://www.youtube.com/watch?v=_4usRrTiqak
How do I use the Save Game Object in Unreal Engine 4?
Source Files: https://github.com/MWadstein/wtf-hdi-files
@dark edge👍
I love HTF HTF/WTF IS explanations. Excellent content. Adriels suggestion to stop watching tutorials and actually understand the core concepts is something that should be repeated more often 🙂 I suggest following their advice
☝️
Is there a cvar or something to display current lag to the server I am connected to?
There should be a ping on PlayerState or somewhere
Thanks!
hm I think that is only working for server browser and such when iteration through found sessions
Maybe it's on controller, it's somewhere
'stat net' was the cvar I needed
ok so im making an FPS as you might or might not know
so when you shoot that gets executed on the gameserver as well as on your client, and then the server looks for hits from the line trace, if it finds any it does everything tied to the "On Hit" event and then multicasts the "hit" back
is this the "right" way to do things?
Hi folks
That variable is for when you are connected.
It sits on the PlayerState class.
Yes and no. There are so many ways of doing this, that you could get away with it.
If the Shot happens on the Client too however, you might want to think about simply simulating it locally.
So basically strip all the authority based stuff from the code, like dealing damage, and keep the visuals like hit effects, so the client doesn't feel the lag of sending data back and forth.
oh yeah quick correction the visuals are on the client but the line trace and hit detection itself is on the server
shouldnt be an issue because many games have some sort of small delay when firing but ill fix it later on if its an issue
I'm still trying to get a flashbang to effect both players but right now it only effects server and the clients don't even see the flashbang let alone the effect of the flash
I'm able to quickly stream whats happening with my code if that helps
bool AActor::IsWithinNetRelevancyDistance(const FVector& SrcLocation) const
{
return FVector::DistSquared(SrcLocation, GetActorLocation()) < NetCullDistanceSquared;
}```
so, yes
Assuming the path is correct for my GameMode, anyone know why this wouldn't work?
GetWorld()->ServerTravel(SelectedMapURL + "?listen?game=/Game/_BALLS/BPs/Game/GameModes/BP_Labtastrophe_GameMode_GAMEPLAY");
Just show the code
Is it possible to run a Client function on a Client that's also the Server? (Host-Client). I thought setting the function as "RunOnOwningClient" would fix this, but that doesn't seem to be the case
Client = remote client
But that would never run on my Client that's also the server, right?
I thought the Client that's also the Host would run two instances of the game, one as the Server and another as the Client, but that doesn't seem to be the case (?)
A Client function will be ran on the machine that is supposed to "own" the actor. If the server owns the actor and it's called on server, it will run on the server with no networking.
The server is the server. The server 'CAN' have a player as well. This is called Listenserver. Where one player is both a player and a game host. The other is called Dedicated Server. Where the server is a whole separate application. It can be ran on the same or a different machine than a player. The only difference is that the server itself becomes a whole different application.
Client = remote client
So by definition not server
Listen server is a server
In this regard though, Client function is not aptly named to describe the issue. As, sure, a "Client" is a remote machine. But the client rpc will still call the function locally on the server, on the correct actor when it's called from "server" code, and the code will still technically run on the server, but on that player's version of the actor.
So it's really just easier to consider the client RPC as something that contacts an actor owned by a player instead.
Anyone have any idea why my arguments above in server travel won't work? I'm trying to load a new game mode when we travel from the lobby to the game.
%GetWorld()->ServerTravel(SelectedMapURL + "?listen?game=/Game/_BALLS/BPs/Game/GameModes/BP_Labtastrophe_GameMode_GAMEPLAY");
Hm you don't need the listen option
And maybe try to use the short codes for GameModes that you can set up in the maps and modes settings
You can give GameModes a unique key there
And then use ?game=Key
I think I figured it out. I reformatted it like this:
GetWorld()->ServerTravel(SelectedMapURL + "?listen" + "?game = / Game / _BALLS / BPs / Game / GameModes / BP_Labtastrophe_GameMode_GAMEPLAY.BP_Labtastrophe_GameMode_GAMEPLAY");
I will do that. Taking a look now.
GameMode aliases or so
Can't remember that name
It's an array or map in the maps and modes project settings
Game Mode Class Aliases?
Yeah
So if I add an alias of "GameplayGM" my new format would be:
GetWorld()->ServerTravel(SelectedMapURL + "?listen" + "?game = GameplayGM");
?
Yes
cool. Tahnks. I'll give it a whirl
Just the listen is still redundant afaik
?listen inherent to severtravel?
I think it's only needed for the first hosting call
Ah. So when I create the lobby session, that's the only time I need ?listen
That argument will be persistent? I did set my sessions settings to allow JoinInProgress so I guess that'll work.
Thanks for the tips. The shortcode works and that's a nice thing to know for future reference. Cheers
Hey does anyone know what the best way to store replicated data is?
In what sense?
As data.
I mean, what's the question here?
I've had issues with structure arrays, they don't replicate well so I was wondering if a data table is better
A data table is just a table of structures, you don't replicate the table itself.
What specific mechanic are you trying to do?
I wanna replicate people's customized clothing
Show your current data setup
Lose the Get Player Character too, just have some data on the pawn or their gear (depending on if gear is actors attached to actors or not) and repnotify on it
OnRep_PlayerGearData -> Apply it.
What class is this in?
It's on the player state
Player state can get to its own pawn, don't do Get Player Character 0.
Anyways, you want an onrep on some replicated data, whether that's an int, bool, enum, or struct
ok, thank you I'll see what I can do with this information
There is no reliable way to do this. If you are relying on any data coming from the client to tell the server something, the client can potentially spoof it.
Yes and no. No, because if someone figures out those random numbers (which can potentially be done via packet sniffing), they can intercept the packet with that version number, prevent it from going, and instead send the spoofed data.
Yes, if you expect no one to be malicious.
Hello folks
if i have some actor with bNetLoadOnClient = false;
and this actor call some multicast function on another actor with bNetLoadOnClient = true;
second actor run that function on both side(Client and Server)?
I believe the ?listen part is separate from creating the session and you just need to open a map with that param before sessions will work properly
For my game, I load into an empty map and instantly open a level with ?listen and then create a session
UFUNCTION(NetMulticast, Reliable)
void Debug(const FString& Text);
void APCSAICharacter::BeginPlay()
{
Super::BeginPlay();
if (HasAuthority())
Debug(TEXT("test"));
}
void APCSAICharacter::Debug_Implementation(const FString& Text)
{
// Debug
UE_LOG(LogTemp, Warning, TEXT("%d"), HasAuthority())
const FString Str = TextRender->Text.ToString() + "<br>" + Text;
TextRender->SetText(FText::FromString(Str));
}
why this not work in client side ?
TextRender is work ok in server
but nothing in client
Ok. So redundant or not, I'm just gonna keep ?listen. It doesn't cost anything
Yeah it likely won't hurt!
i think you are only calling debug if the actor has authority
yes but debug func is multicast
Are you sure the actor is replicated down to the client when you call this? I would find it unlikely that this works before it’s replicated.
UFUNCTION(NetMulticast, Reliable)
void Debug(const FString& Text);
yeah is the replicate checkbox ticked?
Not necessarily the checkbox rather the time it takes, an actor isn’t magically instantly created on a client the moment you spawn it on the server.
Considering that you call this in BeginPlay on probably the server I would imagine it didn’t get the chance to do anything yet.
so what should i do ?
i replicate this TextRender
but no fix at all
im so confused
Should be a replicated property, not a multicast
It's a stateful change
State = Replicated Property
UPROPERTY(VisibleDefaultsOnly , Replicated, Category="Components")
UTextRenderComponent* TextRender;
how can i replicate this then ?
You replicate a string property, and use it's RepNotify to update the text on the component
i will try this now
any persistent change should be made via a property or you risk clients going out of sync with no way to know about it or solve it
does the rep notify allow for the previous value as an argument?
i see
But if you're making an MP game in Blueprint you're already missing all your limbs
What I mean is, BP makes life more difficult and has fewer tools
yeah i understand
Isn't Fortnite something like 80% blueprint and 20% c++?
Fortnite is 80% GAS which is heavily subsidised by complex C++
Well its all c++ under the hood
The way I see it, blueprint is faster for development iterations and allows you to quickly play test and adjust as needed, but eventually you'll probably want to convert most if not all of your game over to c++ for better performance and other benefits.
Looking for a general refresher. Normal TArray supports delta serialization usually? As in if you have an array of structs like an FVector for instance and change Z, then X and Y are not also sent, just Z?
As far as I know FastArrays can't do this, If Z is changed, the entire struct is sent.
Oh, that is convenient. 😄 Is there anything I need to do past specifying the structs and using them by marking them dirty like normal?
Nope just the usual setup 🙂
It is optional in case it causes any issues, but it seems to be pretty safe now. I suspect the packets are a bit larger than with TArray though
Hi everybody! i'm trying to change where i put variables and i'm trying to use more "GameState" for certain things, like what Controllers are on the game at the moment.
Is it okey to say that all the variables (even custom ones) by default are replicated on game state?.
When you say controllers...
You can't say all variables are replicated, you have to mark each one as replicated or not.
If a replicated boolean is set to true and some server event fires that attempts to set it to true, does anything get sent over the network?
I have a few different events that can all set the same boolean to true, but if the bool is already true nothing happens...right?
Depends what that srever event is
If the boolean is already true, it will be set to true again on the server (So if you have a setter method, this will run again)
But only changes will be replicated.
Okay so the setter method is still processed by the server, but only changes are sent over the network?
So its kind of wasteful to do things like that right?
Wasteful, sure?
Yap, i tought they were all replicated by default on the game state, my bad. The game state lives on both client and server
That is correct.... when you say controllers, what do you mean?
I think he mean players? You got the PlayerArray
The list of current connect player controlers
Player controllers aren't replicated
From GM when a new player gets connected, i add that one to a replicated array of "controllers" on GS and from there to the PC and UI
So an array of player controllers on the gamestate will just have the local player's one and the rest would be null I guess?
Unless you're the server.
Yes it's literally the PlayerArray, but you need to GetOwner to get PC
Yes.
No need
PlayerArray for the player states.
its inherited
Don't put things which you want replicated on player controllers, ptu them on player states
it's on the Game State, not on the PC.
From the GS i tell the PC to update the UI with a RPC on owning client
Controllers should handle movement and stuff like that, not hold state information you want shared with other players.
yap, thanks for the data. i'm gonna change the custom array on gs for the default one
However, just because the player has arrived on the server, doesn't mean the player state has been replicated to all the clients
A better way is YourPlayerStateClass->BeginPlay
And EndPlay
i was doing a little workaround to solve that issue, but it makes more sense to control it on the player state if i already have a replicated array of players
gonna try with that, seems more simple
to use "Get player controller (0)" From any Player State is okey or should i use "get owner" and cast to controller?
If you're using it on the server from any player state, get owner is probalby the better idea.
There's a chance that a listen server will fail somehow.
On dedicated I think it fails not listen
Well, if it's for UI updates, then Get Player Controller(0) for UI stuff will cause you to do the wrong thing for a listen server.
But it won't matter on a dedicated srever, there is no UI
I see, was not following up on the purpose. But anyways it's discouraged as hell
so it will fail with getcontroller for the purpose of update UI
better just call get owner, cast and do rpc owning client for ui
You could run the RPC just directly on the player state.
You don't need to use the controller.
The RPC is for the controller
..okay..!
the flow would be.
Ps BeginPlay (authority) -> RPC on Client to Owner
does that make sense or would you recommend other way?
Why the authority check? It's not needed.
Whenever any PS is fully replicated (and begin play is called,) the client it was replicated for needs to call RefreshPlayerList.
Ther'es no need to go through an array.
Or use RPCs
Player joins -> Player state is created on server -> Server calls begin play -> refreshes local player list ui on srever (or not if it's dedicated) -> player state is replicated -> client calls begin play -> refreshes local player list ui on client
That client part will happen on each client
Though this logic will collapse sooner or later, as the list isn't being updated real-time
How will it collapse? It's always accurate per client
I mean, say a client logs out, you still have him on the list
isn't player state, like player controller. Started both on server and client? without the check it would make the call twice if that's the case
That's the idea.
you are right that i can remove the array, i can get that info on the PC
Begin play will be called once on each instance (server/client)
That already happens, you don't need to use rpcs at all.
oh get it now
since it's UI only, maybe just run on Remote of PS?
Better
Then you will break your listen servers.
There is a function specifier that will make it not run on dedicated servers. I don't know if it's accessible via BP.
BPCosmetic right?
That's the one.
that makes sense, remote won't trigger on listen.
Mark the UI update function as cosmetic and your logic is done.
Checks if it's in BP
Seems like cpp only
Only info i could find, not sure if it's this one
Cached 'cosmetic' information about a macro graph (this is transient and is computed at load)
Just in case, this won't work.
only the new one is updated. The one that work is.
When I did Update UI - I assumed this update the entire UI, not just the UI for a particular player
But glad it works!
Consider this situation, though.
There are 3 players. a 4th joins. A 4th player now pops up on the UI. This player leaves. Now, there are 3 players in the player array. The 4th player's UI won't be touched.
That is IF the player state is removed from the players array before endplay is called.
It might not be.
that makes sense, but it doesn't matter in this case, if the player leaves, the changes on the UI should be handled by the Change of level
But i'll keep that in mind for later
Like a charm, thank you
also it's way more simple this way
Np
how would i go on about creating a widget for another client? and that client only.
Some One can help me please! I need to know how best practice about replicate animation in top down character with cursor?
I need tick for this or another way to success?
How do I know if a actor is spawned by a client? Not requested by client, but spawned in client world
Since client has authority over that actor, HasAuthority wont work
Hi, Sorry, maybe a stupid question)
what is the basis for choosing a character revival technique? Usually a character is destroyed and then a new one is created and the Player Controller is put into it. But you can also fake kill a character and then just move it to a respawn point. I want to know why this or that way is worse or better? Thanks in advance
upd:
I think the main reason - the state. Maybe the character had some additional parameters that need to be reset, or he was registered in some systems (for example, AI enemies always know about the character) and so on. Sometimes it's easier (but not necessarily cheaper) to just kill a Persian and create a new one, with clean state and you can be sure he's pristine, properly registered in other systems, etc. If you do not want to destroy, to create - need to prescribe Reset logic everywhere. If it's just to put Idle animation and change the position nat the point of resurrection - go for it. But often you need to "clean" a lot more places.
But I could be wrong.
Generally, its not better or worse either way
One tends to be a better fit for your specific game
HasAuthority() && IsNetMode == NM_Client
Thanks! 😄
hi all, anyone can tell me, on top of his head, why my client side character moves like he's on thin ice, and doesn't stop moving when i stop the input? it behaves like a stuck throttle rather than an on-off input on press. It was working perfectly right before i changed skeleton
Does EnhancedInput have a support for Multiplayer? Because of the "Enhanced Input Local Player Subsystem" context, I'm wondering about that.
Hi
How is everyone
I remember using a variable that had replicated rotation, Was there one or am I misremembering?
Has anyone used listen servers for a mobile game in production?
That seems like a particularly horribly bad idea
Why
Because it takes one user passing under a bridge
To literally kick the entire game
So in real-world conditions it wouldn't work at all
Its not unreal but it has a listen server
"passing under a bridge"? Sorry didn't understand
Amongst many other mobile games?
Isn't Among Us also doing listen servers?
Yes
Say you walk under a bridge and lose networking for a second or two - under Unreal's net model every players get kicked out
... /:
Since mobile is normally not on Wifi 100% of the time
True but probs not the problem
ok...was just considering because dedicated servers are insanely expensive I'm assuming, for a small mobile game
Base Aim Rotation
And unreal doesn't let me play multiple matches in one server process
Other problems with this approach include unpredictable performance (like maybe 10x the CPU load), higher battery usage, and generally poor connectivity leading to a bad experience
Most mobile games aren't fast-paced action, too, so I figure a vast majority runs on Web servers without any of the client's game engine
Your average mobile game is extremely asynchronous with little real-time player interaction
True. Mine's a board game
Looks more and more like i have to switch to using websockets
We've had this discussion before I think but yes I would certainly suggest something like that
Yeah I'm just ruling out all options
SocketIO client for unreal doesn't look promising. They don't have SSL support
I think Minecraft has dedicated servers, too, just like Among Us, AFAIK : https://github.com/Impostor/Impostor
Unreal should normally have full websocket support with HTTPS
Wait among us is dedicated servers?
Yeah
how are they offsetting the insane costs? Any hunches?
What is local match
Local, so lets say we all connected to the same network at a house and play together
That's not possible to know before hand
Just like every other game developer - you have to ensure enough people buy the game and the average playtime x cost per hour doesn't get too absurd.
For Among Us I'm not sure it's an Unreal dedicated
So that could make the servers way cheaper
Yeah it's unity
Yeah I meant Unity - I mean I think they have their own server
Well since you have experience, how much RAM does an Unreal headless server usually eat up? Bare bones.. any benchmarks?
They're using darkrift, it's an open source library
But i didn't think they'd be dedicated, because one of the devs did mention they use a relay
Any thoughts? My VM is 2gb,
If the unreal headless build for this game is like 100mb per process, I'm gonna have to start thinking about migrating to websockets next week lol
Empty, probably a few hundred MBs, but that doesn't help you much. Depends on the game, and if you have a reasonable path to avoid it, just avoid it.
A few 100?!?!!!
Here i was, optimistic as I am, thinking i can bring it down to 10mb through some voodoo magicb 🤣🤣🤣🤣🤣
An Unreal game executable alone is about 100MB so obviously that's a baseline
Why is this not common knowledge?damn, i don't find this info online anywhere
I'd plan for say 4GB per instance with the expectation to be able to drop to 2GB per instance but it's sooooooo game dependent it's a pointless random guess
It literally 99% depends on your game
Baseline 100mb is insanely bad for a mobile game
My day job our unity headless server for a game with a lot of stuff going on (movement, animations, 100s of CCU) is like 60mb
30-35***mb when it's got 2-3 CCU
I may be exaggerating the 60mb, but the base unity + a few CCU is definitely in that range
Actually lemem check rn
"Hundreds of users" is definitely not something you'll see for an Unreal server
Again, Unreal MP is meant for fast-paced action titles with server-authoritative gameplay
Say Unreal, Fortnite, etc.
ok our unity server with 0 players connected is 60mb. Tbf there's a lot going on though
60mb is still a lot
Now 100mb doesn't look that bad
But unity also allows me to run multiple games on 1 server process, so there's that
So it's more like 5-10 games distributed on 1 server. So it's actually 6-10mb per match going on. Which is extremely reasonable.
That's like...200 games on 1VM
800CCU for $30-40 a month
Websocket, your own server.
with ws I can do like 1000+ ccu for like $10-20 a month
one question, do you know anybody (or have you) built a ws game with unreal client in production for mobile?
No, I don't know anyone working with Unreal on mobile. It's not exactly a great fit in the first place
unless it's top heavy (I assume)
Frankly if you're making a game from scratch that's gonna be mobile exclusive it's hard to shake the idea that Unity might be a simpler choice
yeah only problem is we are 95% of the way through
and also I now understand crsytal clear now why unreal is not suitable for indie devs...
even if we were to go through toil to do websockets + unreal client, I'm still scared because it sounds like Unreal clients are also super heavy
and websockets....we'll have to reinvent the wheel with how replication handles everything for us currently
constantly sending messages back and forth, an entirely new API. It would be easier to just rewrite in Unity imo
I mean Unreal is incredibly good for indies, imho. That Unreal isn't good for networked mobile games is hardly an unpopular notion
yeah maybe I'm jumping the gun here. I guess a lot of games are singleplayer
Multiplayer in Unreal is arguably a much better experience than Unity if you're doing something the engine is good at
i agree. i've used both a lot. no question there. that's why we wanted unreal in the first place
Heyo folks - I'm setting up a game server currently and seeking to stack users in a single instance - what I believe I'm looking for is to create a repeater, but having trouble sourcing information around the topic, does anyone have any links on hand by chance?
I'm trying to learn networking, how do I actually talk to a client as a server?
I want to issue a command where I print his display name
you can call methods on the client if you are on the server with UFUNCTION(Client)
I'm using blueprints for now for testing things out+
if you make a custom event on the top right you can set where the event should execute
it should be OwningClient or smth like that
Basically I have 3 pawns in the world and three clients (one as listen server, two as normal clients) and I'm trying on begin play to give a pawn to each client
Issue is the PlayerController is server-sided
you have to do that in the gamemode which only exist on the server too
by using the onpostloginevent (i think)
the event has as parameter the player controller for the character joining but it require some setup
i suggest watching tutorials if you are completely clueless
The server owns a player controller itself as well
yes
when another player join, a new player controller is created and assigned to the new player
Fine, but how do I actually distinguish between the server and the client?
Every command I issue on either the gamemode or the player controller is always fired by the server
So I can't really address that particular client it seems
through the player state that also exist on the client and is accessible throrugh the playrr controller
People who regurgitate this line of thinking are thinking of UE in like 2014 or something. It is ridiculously good for indies.
if I cast the playerstate I use in the gamemode and call a custom event there I still get that the server is doing it three times
Rather than the clients
but if I set it to "run on owning client only" I get it correctly but it is still replicated?
no. because a lot of indies are building mobile games, especially mp, because money is there. and unreal is seemingly bad for that
And a lot are not building mobile games.
i don't want to argue about this, we stem from different regions
I come from india, where 97% of population games on mobile
feel free to read this if you doubt what I'm saying:
https://blume.vc/understanding-india-the-indus-valley-annual-report-2022/
most of us are privileged who are building for PC markets and playing PC games, that's not the case in 90% of the world
what is replicated?
I'm not doubting what you are saying in the slightest. But "a lot" isn't very useful of a metric. Because it can be true in both statements.
that's fair
Know your target audience, choose the right tool for the job. Doesn't mean that a particular tool is not good for a particular demographic.
It's just not suited for that job.
The player controller is always replicated isn't it?
the player controller only exists on the server, it is NOT replicated
that's true. ultimately it's my bad, cause I chose unreal for a small mobile board game
Like, here's what I'm not getting: I have a player controller class with a custom event that just prints a string. If I set this event to "not replicated" then I see in the top right "Server: " printing that string three times (I have three clients, one listen server + 2 normal clients) - HOWEVER if I set the event to "replicate on owning client" I see Server: then Client1: and then Client2: strings
No the player controller exists on client as well! How would you send the input otherwise?
But those three strings are always synchronized between every client, I see them all in every client
I assume that "run only on owning client" meant that if the event is fired on the client it would not get replicated to the other clients
I can show you a quick video if that helps you
Run on owning client does the RPC to whoever owns the object.
Thanks for all the help
I suggest you to take a look at some pinned messages, you can look at eXi compendium to start :)
so when I set it to "not replicated" the server just calls that function x amount of times based on the number of clients?
what?
No - Run on Client doesn't run on a per client basis. It's a way for the server to do an RPC call to a specific client.
Player controller exists on the server and the single owning client. That's what they are saying.
Client will have 1 player controller, server would have X amount.
The player controller exists on the server and client and is owned by the client
oh okay i was just getting confused i gurss, im sorry
But other clients don't see other PC
Only their own, the server sees every one of them
yeah that is what i was trying to say
i did with bad words
I still don't get how am I supposed to address the server's player state
monkey brain hurts
You want to send a message from the server to one of the clients right?
No, the opposite
run on server event
I'm having a stroke
You want from a client send a message to the server?
How do you get the client name on the pawn itself?
From the player controler
The pawn is being possessed by a player controller, how do I get the client name from that player controller?
I'm not sure what you mean by name, do you have a variable with the client name on your pawn?
I'm currently running the game in "Client mode". I have a feature that is, as far as I could see, solely client side because I have branches "is dedicated server? false do something"
However my code is coming back saying it's being run on a server, not on a dedicated server. Which makes no sense to me, I'm not using listening servers in the dropdown run mode
so i need the same kinda thing to do, basically whenever i kill someone i show a notification on the player who killed and the notification should contain the name of the victim, im getting the widget to spawn but the name is always of the server, can anyone tell how i can fix this?
im using an interface message that has the controller creating a widget on multicast
and if the owner controller matches the controller then it should spawn the widget
The client mode is using a listen server in the background I think, if you want to use a dedicated server you need to specify if somewhere.
I meant DESKTOP-389423872394 that thing
that's pretty silly
There was 3 different ones one for each client
does anyone know whats wrong here
You have a is server node
(dedicated and not dedicated)
there are some things that need to be on a listen server but not on a dedicated server
which is why I have is server and is dedicated server branches
Even for a BP project, is it a wise idea to define mostly all variables in c++, just in-case they get used in code for whatever reason?
I think playerstate already contains the variable that would have that value.
Yeah so if is server but not is dedicated server
ok but the issue is, I can't get my program to launch as an actual dedicated server
so those branches don't work
any idea where?
I checked the settings and don't see it
unless it's a launch option thing
any idea about this :/
the playerstate thing datura said
It should be in the settings, sorry not at home so I can't help right now
tried, im using the player controller to get player name since the one spawning the widget is the victim
Which unreal version are you using?
hm, will keep looking I guess
5.0.2
You can't use player controllers to get player names as the player controllers are not replicated to all clients.
oh i see i see, in online subsytem do player states have the same name as the steam name?
so how do I get my own player name locally?
If you know the pawn then you can get the playerstate from the pawn.
without calling the player controller
For an example, this "Player State" variable exists within all pawns, so I can use that to pull the player name.
. this though
Hey guys
Is there any way to validate weapon spread
Or is that a pipe dream even If I made it deterministic?
wow the player state node really worked
so you want client side hit detection with server side verification?
Yeah
Yeah, same random stream or seed or whatever.
I get that, but how do I validate a shots rotation, accurately, I guess I could check on the server by recording the control/ cam rotations, then when I fire locally, check the history to make sure its correct but wouldn't bad network cause invalidations where there is valid data>?
do you know how to force the editor to actually launch a dedicated server?
launching "client" seems to launch a listening server still
should launch a background deducated server not a listening server
that's not happening
I test with launching, not pie. But it shouldn't matter. If you set stuff up correctly, you should be able to play standalone, listen server, dedicated server, without changing anything
yeah I'm using out of the box "client mode" on the editor
and it's not launching a dedicated server apparently
How do we launch a separate dedicated server?
If you have multiple copies of your project open, it can bug out the dedicated server networking setup - make sure you only have one open.
I only have one
In fact I just read the unreal documentation and on UE5 it should spawn a dedicated server in client mode
I can't breathe
Launch it in standalone mode. PIE can be funky.
that was my understanding, I haven't modified anything
and my settings say it should launch dedicated
which is why I'm confused
In previous versions you had the check the dedicated checkbox but now it does not seems to be the case
How do you validate this though, because right now I use a check to see if the clients camera is in the right direction
So anything within like 50% of the screen could pass
You could re-run your test on the server with an RPC and send back a confirmation to the client with another RPC, if it is true do your effect. (Prediction is quite a hard topic so this would be with prediction on client)
Yeah on the server it does a test to see if your angle between cam forward and client 'reported' forward is in 45 degrees
After some testing
Hello