#multiplayer
1 messages Β· Page 637 of 1
If you have an idea can you explain it to me when you have time please
hi guys, does anyone know why when updating Character Movement properties in construction won't update for client? but if it's in BeginPlay it update on both Client and Server
@peak sentinel nope they are just scene components
I tried to read the question multiple times but couldnt understand what exactly is the problem but I feel like using integers is a bad idea, I would have a base vehicle pawn and seat pawns attached to it, and let player characters attach to seats then possess them
All seats have a reference to base class so every player in the vehicle can access / interact the vehicle
If you would like to speak more about it you can send me a DM, I guess we are speaking the same language
Heeeelp meeee
When I join a session it shows the level for a frame then goes back to the default level.
UEnum::GetValueAsString(GetNetMode())
error LNK2019: unresolved external symbol "class UEnum * __cdecl StaticEnum<enum ENetMode>(void)" (??$StaticEnum@W4ENetMode@@@@YAPEAVUEnum@@XZ)
I am trying to print the net mode on the screen but something's wronh
wrong
You're either missing an include, or a module.
maybe, but I think it is GetNetMode related
oh
I already included #include "Net/UnrealNetwork.h"
and GetNetMode is located in Actor.h so that doesn't matter
thing is that this works: UEnum::GetValueAsString(GetLocalRole())
oh damn
Does enabling Component Replicates on a Physics Constraint Component do anything significant?
Hey Guys, i have a question about servers.
I'm making kind of a puzzle/card game. I have different cards/puzzle pieces that i want to store on a server. So all players can access them. My Game is based on 1vs1 maybe 1vs1vs1vs1 rounds. So would a Dedicated Server be better or one where Player Host the Session?
When i understand it right, i don't need an extra Server when i use the Player as the server.
But when i have something like a Leaderboard, can i store that on the same server as my cards/puzzle pieces?
Wouldn't my Cards need to be worldwide to? Where is the point of using a server to store data when you don't use it for worldwide?
hey guys I am new to multiplayer programming, So my question is what should programmed on player controller and what should be programmed on player charecter
@woven hazelNo one is going to be able to answer that question without more specifics. That question extremely highly varies between game types, design styles, etc.
oh ok, tnx for your answer buddy
where should I movement code, in character or player controller, I am building open world game like destiny
Movement should usually go in the pawn it's associated with to avoid unnecessary logic branching. If you have different pawn types and you put it in the controller, you have to check which pawn type before doing it. If you put it directly in the pawn, the controller never has to know what type it's controlling and the controls will work independently.
Tnx for you answer buddy, I will keep that in mind.
Is there something special that you need to do in order to get "OnRep_Instigator" to be called
have the Actor replicated
@tough pumiceBlueprint or C++? If it's blueprint, just set the variable somewhere, and make sure that the object is replicated, and if it is a component, make sure that the actor it's on is also replicated. The same applies for C++, but the server also needs to call the OnRep manually too.
Am I setting up this server travel correctly. Its the correct file location, seamless travel is enabled, and the node is being called, but it doesnt do anything.
bump
I forgot to call super on GetLifetimeReplicatedProps doh
@distant waveI would wager it won't do anything other than make the component replicate. A quick search in the PhysicsConstraintComponent.h shows nothing is marked replicated. And on top of that, physics things are generally regarded as not network friendly. If you wanted it to do something with network, you'd likely need to subclass it and do that stuff yourself, or make an actor that handles that stuff for you based on replicated conditions.
Alright, thanks!
Anyone know if world composition in multiplayer is viable with the latest ue build?
I had just a quick logistical question for a multi-player function i wanted to implement. I want to add a money and xp system to my multiplayer game but I dont really know what the industry standard is for doing that. Do most games have a database server with which players values are stored in?
how do I quick a player from a session in BP
I think thats how it works, Stuff like that is stored back end
and validated then updated as necessary
Hi! I have a little bit of problem with the actors position. When someone join to a started game, the actors are floating in the original position, and the physic is not working on the actors (in the client), just if the client interact with them. Any idea? The bug doesn't exist in the editor, just in the builded game.
How are you replicating actor positions.. a movement component or an RPC? @narrow leaf
Check if the source has something about them
Might just be me failing to copy it properly
i guess its composition if uml
THey usually describe relationships
nothing on the source apparently, but i'll keep looking
Does it look the same?
yeah it's just a circle instead of a diamond
I don't really have an explanation atm. Might actually remove them in my version. The important part to take away from it is what exists on which player
The line itself is how they are referenced
So you can access all the playerstates in the GameState
But you can't actually, at least not directly without GetGameState, access teh GAmeState from them
Controller usually has a ref to the pawn it controls and other way round
Controller has a ref to the hud and the playerState, where the owner of each is the controller again
And the Widgets inside the HUD is preference
Yeah, again, if you ignore the lines and numbers, it becomes a bit simpler and it's mostly about that GameMode only exists on Server etc.
got it
@normal ermine you can read diamond as Contains and the numbers are if it's a 1 to 1 relationship or 1 to many
There is 1 GameState and it contains the many PlayerStates
There is 1 of each PlayerState PlayerController and Pawn associated
PlayerController contains the 1 HUD which can contain many UMG Widgets.
Yeah, but the Controller Pawn and Controller PlayerState would also need one then :D
How do I add a widget to all clients on a listen server?
NetMulticast
well multicast runs on the server, UI is client only
multicasts will execute on all connected clients, if they are called from the server
Read about it, this file is very good: https://mega.nz/file/GtIXGYwT#mvd0dyuO_abl2nOJj6y-FcUTsHwLCNknHVw7tf44QL8
Does anyone have any insights/wisdom to share, in regards to how to manage a predicted state with a non-predicted state?
For example: imagine you reload your weapon. The reload process is completely predicted and undergoes syncing by replaying inputs. But as you reload, you consume an item in your inventory, which is not predicted (it's just a fast replicated array). All is fine until you perform a resync by replaying inputs - during which when you try to consume the inventory bullets again, the 20 bullets you had before are now 0, which means you couldn't reload during the resyncing process, which means a jitter until you fall back into sync
This has me pretty stumped, I'd really appreciate all kinds of input
when you say "undergoes syncing by replaying inputs," could you explain a little more?
do you mean like the character movement component's system of replaying saved moves when corrections are receives
received*
Basically that, yeah
(although I dont use CMC, but my own system, it's still the same ideas though)
so you predict using your item in this scenario, but when replaying moves you can't "unwind" the item usage to restore it and use it again?
Yeah exactly
Because I don't do all that fancy prediction stuff for big things like inventories
im trying to figure out how you would end up in this scenario. you wouldn't actually use the item client-side i think, you would just check it exists, then when the server goes to reload, it would actually use the item, but then you wouldn't have to ever replay the reload input since the server confirmed it happened, you usually only replay inputs the server hasn't acknowledged
however i dont have the details of your system so i could be missing something
ah wait sorry brain lag
yeah, you would have to avoid using the item on the client side in favor of just checking it exists and only actually using it server-side
no problem, I had the exact same thought process first
the only issues would arise if you tried to use it twice before the server confirmed the first use, which would lead to a rollback
either that or you need to save some kind of state with your client moves, so that when replaying them you can rollback your inventory as well, but that would get fairly complicated fast
Yeah, maybe some kind of message system?
A 'if you're resyncing on tick 37, you actually have 20 bullets here so use that' message, that is placed during prediction and read during resync?
yeah that's basically what i meant by saving some kind of state with your inputs
you could even just have the server send its state when confirming a reload or whatever "your reload succeeded, you have this many bullets and this item in your inventory at this timestamp", then every that is resynced after that would start at that base state
its a little vague because it really depends on what all you're syncing here and how much you want to save, but the general idea is that you need some information on what things looked like when that input happened the first time
Yes! Awesome
even if you're not using character movement (its not related, functionality-wise, to this) i would still try and read through how FSavedMove works and the way unreal deals with replaying movement inputs, its specific to movement but the concept is the same for any kind of prediction/rollback/sync system with inputs
i did my ability system using the same idea as what they did with character movement, having all my resource usage and ability cooldowns based on prediction from a given server state
Did you ever tackle a similar inventory problem?
i am not doing a game with inventory, so no not that specifically
but the concept is a very common issue with multiplayer
and its not an easy problem either
I still remember my bullet count jittering when playing half life 2 deathmatch and reloading weapons lol
Thank you very much for your help, you just un-stumped me π
Does anyone have any idea why ServerTravel does not remove UI widgets when it loads the new level while using Seamless Travel?
I'm fairly new to setting up multiplayer. Is there a way to send event tick information across the Server?
I could also be doing this totally backwards, but I am curious to know lol.
wdym?
I think I found the problem. I misinterpreted what I was seeing.
Event tick on Server is working just as it should
Object kept hiding on tick for just server, so it looked like it didn't work
Do player controller variables not persist on joining a server? Trying to use it for a character select, but nothing's working
No they don't
Nothing despite the GameInstance persists joining or leaving. Or generally hardtravels
@quartz smelt
Cool thank you! @thin stratus
For multiplayer scenario, with a standard widget based inventory where each client has their own inventory that is saved on each clients PC.
If i have a pawn and a pickup, how should the sequence be when walking over it? OnOverlap check HasAuth and then call Pawn and ask Pawn to destroy the Pickup and then call Owning Client with info that he picked up the Pickup item, so it's reflected in the Client's inventory?
or is this kinda going over the river to fetch water?
thing is, i would like the server to "guard" or govern who gets an item in case two people walk over it simultaneously, while at the same time have each client keep track of their own inventory without having to store it on the server (guess something like a classic listen server+clients scenario).
Guys, is there any good docs on how replication of objects/properties works?
@hollow halo Thx
is there a standard for where to place functions? I have the player controller and player character, for things like line traces / dmg text / HP etc. is it better on one or the other?
I usually refer to this when I want to know where to put things
for example if you have your hp on the player controller only the server and the owning client of said controller will know how much hp left you have
it could be okay or not depending of your game
On my project I have the hp on the pawn so when the pawn die i destroy it and spawn a new one without having to reset things on the previous one
page 9 of the pdf to be more accurate
you have a diagram telling you which class is present where
You mean like deep down in the Engine? Cause my stuff is more like an overview of how to use the stuff, not entirely how it works.
@thin stratus Yeah. I just finished the pdf @hollow halo sent me, but it is about how to use it. I want to know the background of it.
Like how does actor replicates. How do Array gets replicated and stuff like this
Didn't realize the author of the pdf was on this discord big thank you Cedric it is a really helpfull document
Yeah, great pdf, btw π
No biggie, glad it helps
But yeah, if you want to know more of the inside workings, you will have to read through the engine
Some stuff you can find in the PackageMapClient or so
That's the thing I looked at last, where the Client gets the replicated objects and actors and spawns them etc.
I guess if you start on the netdriver where the packages come in and go from there, you already have a lot to explore
It helps having some simple spawner or actor in an empty level to be able to breakpoint stuff
And then just stepping through it
For projectile only weapons, whats the best way to handle prediction?
If ping is not higher than a given value (125ms) I just fire a fake projectile on client but if latency is high I dont know how to handle lag compensation
Found this video.. More details about multiplayer..
https://www.youtube.com/watch?v=JOJP0CvpB8w
An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.
Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe
00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...
@peak sentinel The one way is to spawn projectile on client as soon as player press fire button. Then you can leave it as is, if client projectile is not so relevant and more like a visual, or you can switch it with replicated version as soon as projectile gets replicated. But it is not good for weapons with high firerate..
Yup, I guess also thats what UT does, right?
Visual projectiles are ofter just an FX effect
And the server does the real job with line traces or projectiles
But it is not good for weapons with high firerate.
Sadly I have choosen a cursed game design and my angle is top down, so even my automatic rifles are firing projectiles
Sometimes fire rate is even 0.1s
Well, with weapons with bullets we use delayed line traces
Or a single line trace for a pistols or smg's
And we do them on owner client, by the way. Deal damage on client and server just verifies it was not fake. That way client get's best experience, but he is not able to cheat as server checks all the stuff.
Other clients simply play FXs
So I should only send server RPC for starting a timer for my weapon to shoot and shouldnt care about anything else?
Hey, does anyone here have experience with aws gamelift and cognito?
I am working a way for players to build robots and am trying to figure out how to best architect it. The individual robot components are piece by piece by the clients and the pieces are verified server side before they are instantiated. The question I have it 2 fold.
- I had planned on sending basically a string description of the component along with component specific parameters to the server. Something like {Socket}/{ComponentType}/{ComponentProperties}
SHOULDER/CANNON/ROTATION=10,PRELOAD=TRUE
The different object types would have VASTLY different properties. The server would validate this string for the request and spawn the relevant object and attach it. Then...
- These instructions could be strung together into a recipe for a given robot that can be reused, shared, etc.
How does that generally sound? This is without using any formal serialization.
You can directly replicate structure
How so? Is there a way for the user to just build the object locally and then request that the server instantiate said object?
I imagine you have different slot were you can put different part depending on what you want on your robot
Right.
so you have a struct robot which for each slot contain a struct describing the part
you send the struct robot and the server instantiate it
and if you wan't to share it as copy paste string you serialize as json or something like that
I wonder if I even need that desc now. If I just have the server instantiate it (assuming that the network speed doesn't make this too laggy), then the user can modify the settings (which would also go through the server) and replicate everwhere that is needed. From there I could just serialize. The difference is that for the initial creation, I only need to send the type and socket.
If you don't have per item customization one name should be enough to identify the part and a tag/name/index for the socket
I do have per item customization, but that can happen after is it instantiated and replicated. In game, all clients would get the initial actor, and then whatever modifications happen to the component. From there, when I save the robot, it can just be serialized regularly. Right?
If you have customization I would store them with the part and send them when you initialize them
For example, they add a cannon, and they pay for a larger bullet (enum) type. That would be set on the replicated actor.
Right. I was thinking that initially, but that would mean creating a client side only actor, having them configure it, hold onto the config settings, and upon submitting it, get a replicated actor and delete my local one.
work directly on the struct when you make a change and replicate the whole struct to instantiate a new actor and delete the previous one
Got it. And is that for the sake of a snappier UI?
No I did it like this for the sake of simplicity
@surreal plaza my vehicle parts have a structure that contains arrays of integers, floats, vectors, booleans, and corresponding text for tool tips and other helpers for min max values. Works pretty well
So for a transmission, integer zero might be number of forward gears, integer one might be number of backward gears, the floats are the individual gear ratios,
Oh, that is interesting. The cars are configurable then?
Really old clip but it'll show you a little bit of the prototype work in progress
https://youtu.be/WAZWfSwHFXk
Yeah, same thing. Do you handle creating the wagon locally with custom components then ask the server to instantiate it? Or does the server instantiate upon start then updates are run through the server?
if it help usegobos i can show you how i set it up
I think I am ok with how to program it. I just want to ensure that it is performant and flexible.
It is surprising how little information I am finding on serialization.
by serialization you mean replication or saving ?
Saving. I was hoping that for completed robots that could be loaded from a local library, I could just do traditional deserialization from the disk.
You can you just have to create a blueprint which inherit GameSave and put your structs in it
I am assuming that works in c++ equally?
what work in blueprint work in c++ but i did it in blueprint personally
I am seeing some saved game info, but not as much for saving off an individual actor.
you can't save an actor you can only save struct and base type
arrays of structs and base type work also
Oh, ok. So by default I am limited to that. Do you have a tutorial or description of this anywhere?
to save ?
Or buzz words even.
Yeah, specifically struts and base types as part of a save game strategy.
Overview of how to save and load your game
on your struct you also have to check what attributes you wan't to save
I have an inventory system that correctly replicates from Server to Client. My changes from the client aren't replicating to the server. I've decided to make Server RPCs to be called from the client. I get infinite recursion and a stack overflow.
I have functions such as
void DoThing()
{
if (!GetOwner()->HasAuthority())
{
Server_DoThing_Implementation();
return;
}
// does stuff
}
void Server_DoThing_Implementation()
{
DoThing();
}
HasAuthority() is returning false even though it's being called by a function called by a Server RPC (this is inside of a replicated component)
Does anyone know why this seems to be the case? Using GetLocalRole() has the same effect
You don't actually use the "_implemntation" version of your method right?
ahh, sorry. I call Server_DoThing()
I have a question about how to implement weapon accuracy in a game where the server trusts the client.
My client sends an RPC for each shot fired saying they shot from point A and hit something at point B. Server does some basic validation like: is point A close to the server location for the client? Run raycast on server, does it hit anything before reaching point B?
I added some code to randomise the shot direction the longer the player is firing, but how can I validate this on the server?
Changing to server authoritive is not an option.. maybe this is an impossible thing to validate.
Im confused as to why a server would not be the authority. Performance concerns?
@silent valley FRandomStream is probably the answer which you seek, though I have to echo the others' points too lol
sorry, didn't see the replies.
I'm taking the fortnite approach where clients are trusted to a certain point, i.e. if a client sees their bullet hit someone then the server will apply damage.
Server does some validation to try and prevent wallhacks etc.
The server validation is the tricky part in this case though.
It makes sense to do some validation on the server, even if the client is claiming the ray has hit.
E.g. is there ammo in the weapon? is the fire rate within expected bounds, etc
I probably got the terminology wrong, I guess the server is authoritive, but it mostly trusts the client if they say they have hit something.
I think ShooterGame also does this
I'm using Get Player Controller and Get input key time down for Multiplayer, but it only counts up for other players, only the first player I suspect. How do I set it to be different depending what player it is
Do you guys know if multicast events are required to be reliable? If I declare a UFunction with NetMulticast but not reliable the compiler exits with code 6
UFUNCTION(BlueprintCallable, NetMulticast)
^ breaks
UFUNCTION(BlueprintCallable, NetMulticast, Reliable)
^ works
In my case the pawn is the chassis, with attached actors as vehicle parts. Everything is spawned on the server and replicated
you shoudl have to put Unreliable you cant leave it blank
Weird, is that new? I swear for years I've put nothing...
Ah wow, who knew. Thanks @eternal canyon !
I know in blueprints you can send an array via an RPC, is there a way to do this in C++?
Derp, ref, right, thanks! Mondays.
Well Monday, and stupidity, let's not get it twisted.
I think this is it @foggy idol but don't quote me, I can't test it because I am at work. https://docs.unrealengine.com/en-US/BlueprintAPI/Game/RemovePlayer/index.html
Remove Player
Tried that yesterday, Either does not work or I am retarded
That should only work on local splitscreen players
If you want to Kick, send a Client RPC to them and make them leave.
Or destroy their PlayerController on the ServerSide
Oh, my bad, yeah then I got nothing. I just realized I answered this in multiplayer. Will teach me to Discord from work.
I Tried the destroying to no avail so Ill try making them leave client side
thank you
anyone know why https://prnt.sc/12rnap4 doesn't run the event on the other blueprint? I'm doing a line trace which hits an actor in the level to determine the target. It works on the server but it doesn't work on clients
Ownership
One of the biggest, fundamental things in UE4 Multiplayer that you need to understand
You can't call a Server or ClientRPC on Actors that aren't owned by that client.
You have to perform the RPC in a ClientOwned Actor
Such as PlayerController, PlayerCharacter, PlayerState, or custom actors that have somehow a chain up to the PlayerController as the Owner.
I see, back to the books for now then thanks
Means you want to RPC and then perform the LineTrace.
And never have a ServerRPC to deal Damage, that allows cheating
Only inputs should be moved to the Server via RPC (+-). Server should then perform the action to damage, including all prep work, like LineTraces.
What about client-side hit detection with server-side validation? Just sending input sounds like a recipe for the opposite of a snappy experience
You can always setup some prediction if you need that
I mean I guess you could consider client side who detection with server side validation to be a form of prediction
Yeah
You can go all the way from trace to damage to changing the healthbar
And it's nice predicted,
But you will probably also run into some areas where you can't predict
And you gotta endure the lag
The only difference would be the a hit doesn't happen unless the client thinks it happened. So the client misses out on errors in their favor if their view of the world is drastically wrong
Yeah there was a name for it
Can't recall, but basically that the corner peeking person is in favor with this
Didn't they call it favor the shooter in a couple talks
Yeah same idea I guess
It all has pros and cons, but generally speaking you rather want the input to be RPC'd.
Also heavily depends on what kind of game you make of course
A highly tactical shooter like Valorant, probably needs a different solution.
Buuuut, even then, calling the RPC on the Enemy is wrong anyway :D
Wich way is less network heavy and better?
- One RPC to spawn sounds with a "sound" and "location" parameter
or
- Multiple sound spawning RPCs without parameters where each sound and target location is predefined
Will be a mix of frequency and size
If you can just do the sound by a simple int32 lookup and just send an FVector, that's not too bad
Are you hitting any limits that you need to optimize on such level?
Otherwise, stop bothering
The amount of data you can send now-a-days is usually covering most multiplayer games
Instead of optimizing single RPCs, you should use the Network Profiler and/or Unreal Network Insights to see what makes you reach your self-set bandwith limit and then optimize that part.
I remember a terrifying post about someone showing profiled data that indicated they were running into bandwidth saturation at 8KB per tick
Well you can set the limit in the ini files
Maybe that's the default value, not sure
It's way too low
If memory serves he tried all that but ran into issues. Was rather scary, made a bookmark just in case π
@floral crow shoutout and salute π
Hm not sure, last project I worked on had no issues on that front. Most issues were actually related to poor prediction handling via GAS.
What is the recommended way to uniquely identify a player in a multiplayer game for persistence?
The NetId
Which is usually tied to the backend you are using
Or "OnlineSubsystem" in some cases
FUniqueNetId? That's what I thought.
Yeah
E.g. for Steam that would house the SteamID of the User
If you aren't using any OnlineSubsystem, or any sort of "authentication" system, then you probably have a bad time persisting userdata
I've just started going down the GAS route, any good tips on the prediction handling issues that you mentioned?
Well, for us it was about abilities that he player could execute. They were living on the player (client) owner GASComponent.
In theory it's pretty straight forward, you set the ability to be predicted and handle the ActivateAbility call as such.
Only thing that threw me off was the way the PredictionWindow works
Some latent nodes, like a simple delay, destroyed the window and the client stopped predicting GameplayCues after that.
Same with Timers
Best thing is to read the documentation (unofficial) that is pinned to #gameplay-ability-system
It helps catching problems early
I found GAS pretty obtuse. I landed on Able
The one that Dan posted, or Tranek on Github
Yep, been using it as a bible indeed
Coworker worked with that a few days and cursed more than ever. Never touched it again afterwards.
Oh, what were his gripes?
I bought it before
But decided to go with GAS in the end
Can't say, never really talked about it with her. But she wasn't happy with how it was setup.
She was fighting it more than using it.
But could be just a different way of thinking I guess
GAS is also a struggle. It wants to replace the need of coding an ability system from scratch, sort of "Teach someone how to fish" wise, but it's also kind of a mess in a lot of areas.
How bad did I mess up when repNotify just trigger on server when changed?
Depends on what your setup is
There are bugs with RepNotifies, not sure if only BPs but well
Typically a sound doesn't just ay in a vacuum and is associated with some event (shooting, hit, etc) just piggyback off that
You know what.. the component was not set to replicate, that did the trick. Sorry to disturb you guys. π
where do i store a player inventory? PlayerController?
i thought of that too, but player state is replicated to all clients?
Does anyone know what Epic Online Services is? Do they offer free game servers or just the SDK to run on your own server? https://dev.epicgames.com/en-US/services
I'm an idiot, I didn't even realize that was a channel
Ok thanks. I personally like to code that stuff myself lol. I just need the servers
If any of you have experience with Unity, which game engine is easier to implement multiplayer?
in a respawn scenario where i want to respawn with inventory intact like in most rpg's easy mode, would playercontroller be ok to store inventory?
and playercontroller persists over level loads right?
What do u mean by that?
Is multiplayer difficult to implement with Unreal? I haven't started my project yet bc I'm currently picking the engine I want to use
Is C++ required to implement multiplayer? C++ is like black magic to me. I know how to code in like every other programming language though
also since you didn't ask in #epic-online-services yet, the answer is no
it's actually not either of those things really
you can do multiplayer in BP, but if this channel is any indication, it's a painful experience
Hi there! Now that you mention it, I'm still curious about the answer. Never found anything on how to increase that seemingly artificial limit π
Anyone know of a tutorial to watch for multiplayer/networking? Preferably blueprints, but CPP works too
Also would you guys say that multiplayer is difficult or just a pain in the ass?
Well thats convenient lol
evening everyone
what does this mean :
OSS: No game present to join for session (GameSession)
on PlayerController::BeingPlay, I call the GameState, which in turn calls the GameMode and assigns the PlayerController to a team
Everything works if you're the sever, or a single player
as soon as I spawn 2+ players, I get the above No Game Present error in the console
Is this a legit error to worry about, or can I ignore it?
Lol love this answer
@upper lynx that probably has something to do with play in editor automatically joining. It's probably trying to join the session that doesn't exist
Hi! I had a similar question in the past. When I start a game, and the client join to the game, in the client vision the actors (static mesh actors) floating in the original game position. I use replication movement. The StaticMeshComponent is not replicated. Any idea to fix?
Replicate the static mesh component .
Thanks. I tried this, but its a little bit buggy sometimes. Nevermind I can fix it.
I'm sitting right now on a fps game and thinking how I can do it with the accounts just store in a database? Log in? But how the whole thing in ue4 I have no clue how to build the whole thing. And then the problem with dying. I have a dedicated server there people connect to it so then the game starts at some point and how am I supposed to know who the player was that died? And by whom he was shot down.
Last question would be. I want to make a lobby like fortnite. Do I have to build a lobby server then? Or how? That the characters are there and everything? Because somehow they all have to stand there.
C++ btw
Not bp
any tips for fast-firing weapons? my ability system is all set up for predicting abilities, their resource costs, and their cooldowns, but with the caveat that they don't predict the actual cooldown duration, they just put the ability on cooldown and wait for the server to RPC back the calculated cooldown length. in trying to build weapons on top of the ability system, i run into issues if ping is higher than cooldown time, where you're actually unable to shoot until the server tells you your cooldown length, which is longer than the actual duration between shots. this is a problem for any weapon firing faster than 5-10x a second
Lobby is just another map where client have minimum controls of movement.(sometimes invisible and only let them do the menus)
To my question?
Don't do it like that, I think Overwatch have an GDC article/presentation about this. You still do server authenticate controls, but you predict the inputs or update the input queue if new packet arrivesm
Yes
But wait
The problem is all players on one server
Dedicated server
And wait
When I will play with 4 friends I will only have the 4 players in my lobby and not the other 1000 on the server yk
Idk how I can make it
But I have one lobby map
Yes, same thing. You spawn a map for a lobby
I don't know if you ever played mod like Rocket Arena in quake era
You can have like 64 players and still they go into their own subjection of maps
The problem is I have a map. And there go all players on it and do not want to have all but only the 4 and in another lobby with friends also only the 4 but are all on one server you understand?
Depending on how you would implement world travel(aka switch maps)
Itβs hard
I didn't say it's easy, but eventually you will have to follow UE4's convention unless you are willing to code your own hosting/join framework
For UE4 you have to load a map after join a server.
Sure, sure. Only how should I do that with the lobby map I mean many players are in the lobby only you should see only those who are in the lobby...
Say one server already have 100 and another just have 2. Traditional way is mod force transfer 2 teams to a different server once the match is done
So other server is populated.
(cause most certainly people will join leave between matche)
That you need some sort of database back end to do load balancing between servers
I have a dedicated server. Now the problem is, you can play with friends and before the game starts you are in a lobby in the main lobby with the interface etc.. Like in fortnite where the 4 players stand. Now how do I do it that only the 4 players are seen who are with one in the lobby or party. And not the other 100 players
Thatβs the problem
How
I donβt have an idea how
Like that
I will only the lobby system how
If you load the map and assign them the lobby pawn , they will see exactly what you want to show them.(before the count down and spawn into actual map)
Okay
Don't over complicated things, a pawn can be anything, not always the player character with fp or to camera
Don't I have to spawn the players all one lobby? Actually, thousands of lobby maps must then be generated or not?
You can make them a static cam with a sphere if you want.
Eh, you probably need to read the multiplayer host join flow more
Yeah ik but the problem is the 100 players on server and one lobby map and I will only see the players in party or I will see own lobby
You don't spawn thousands of maps
Player join and gets assigned to a map
It can be lobby only maps(aka the traditional queue waiting map before a match starts)
If can be a live match map but with lobby pawn
(say you are in a orbital room for character customization)
Yeah, so that is a specific place or standalone map before server transfer worlds(aka maps)
Everything is on server
Player just have the assets locally so you don't need to distribute those
Ahhh
i have a rep notify variable on a widget. the rep notify is never sent to client. What am i missing ?
Lol, like I said, a lobby pawn
@regal maple That screen there is the lobby, lobby is created by the party leader, basically becomes a "party"
when you find a game, it tells the matchmaking system, i have X amount of players in my party, find me a server
then it connects to that server with open level (fortnite does not use server travelling)
this is when you end up in the game on the start island (waiting for the other players)
the party persists, so when game ends, you end up back in the main menu with the party
Yes yes but how can make it wait also I have a lobby alone with me so at start of game. Now I request a party join to a player so then I accept the party how render the other character yk
I will show up he in the party
In Screen
But other players will have Same a lobby with no player or party members
this is not something you can do with less than 1 year UE4 experience in multiplayer/networking
excuse me but I have a question, is there something wrong with server travelling?
no we use it in our game
just in fortnite they don't need to cause you are not in a game server when your in the party
so you have to connect to the game server, and you cant server travel
aaah I see, thanks
if you are connected to the server, then you can server travel between maps
Im using steam subsystem, and I created separate map for lobby host to wait for others to join and then do a server travel to gameplay map
check the ShooterGame examples
Is this hard in c++?
@meager spade
because that is what unreal is about, that balance between C++ and BP
heavy lifting/framework in C++, rest in BP
no i was generalizing
it's not easy for sure.
Mehhh
i would focus on making a working single player game or very basic multiplayer game before doing any of this.
you seem to be well out of your depths
But my problem is to understand the player handling but I have one map and 100 players but I will only render players on pods who are in party Xd
i would not even do 100 players with your level of experience, no offence
Or 10 players
there is more to it than just this. Making it so the game even supports 100 players is a big thing
Ok
Mehhh
I hate game development
I love web I think I switch
Game is to hard and Iβm confused
Sorry to hear that, but if you ever decide you want to, try https://learn.unrealengine.com and not make an ambitious game with no game dev experience. Everyone can dream, but with no knowledge/experience, that is all it will ever be.
I can c++ but not ue
That the thing
Haha
Ue is Hard af
And the docs not so good for dedicated server btw itβs not so nice
Yes, but knowing C++ != knowing Game Development. My friend works on embedded systems, he knows C++ a lot, but put him into game dev, he would struggle. He even knows that.
When i run script on an actor, it seems to run on every other actor, as if its multicast. Is there any way that I can only run script on a certain actor? In this case i only want to run script on the actor that overlaps the weapon
The script that is being ran (inside of the gun that I walked over)
Look up the documentation as you need to look at what the different types of proxies are
ty em
When you use Server travel will the event "onpostlogin" still fire for every controller when the new map loads?
you can also use SwitchHasAuthority to run code only on server/client or IsLocallyControlled to run code only on the local player
I'm trying to follow the dedicated server tutorial and unreal engine docs says I have to be using the github version or something? Is this true and why? https://docs.unrealengine.com/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/index.html
How to set up and package a dedicated server for your project.
Correct, you need to build the engine from source.
There are no server binaries distributed with the launcher version. Why? Because Epic decided not to Β―_(γ)_/Β―
Is it possible to run a server without building from source? Maybe through command line arguments?
UE4Editor.exe ProjectName MapName -server -game -log The wiki shows UE4Editor.exe is required. That doesn't make any sense
Just pass those options to your packaged build.
So I would run ProjectName.exe MapName -server -game -log Instead?
It's not technically the same as running a dedicated server binary but it's as close as you're going to get without building the engine yourself.
Wait so couldn't literally anyone who owns my game start a server through the command line? I wouldn't want that
Yes. And that's why when building from source you can build a client-only version of the game.
Or server-only binaries (which is what a dedicated server uses)
can you build client only in the launcher version?
No.
Well fuck to this. I'm going to download source code then
The only variant you can build includes both client/server code.
That seems just completely stupid to me honestly
Epic assumes anyone really needing the additional configs should be using source anyway.
And so they only ship a single game config.
Yeah but think about it. I don't want anyone random to just be able to run a server
I guess they wouldn't be able to connect to it tho since they would need to edit the source code of the game
You can pass options to connect to a server on the command line.
ok so they can literally just run their own server, thats bogus
Again, if you're doing a true dedicated server setup you're probably better off using source anyway. The binaries shipped with the launcher version are just for the "easy" use-case, which is all features you'd get in the editor enabled.
How do I get this pop up? I linked my github to epic games
oh nvm it sends u an email automatically
Curious why the NP plugin uses MS in integers instead of floats for the fixed timestep. Consistency? It will fit in 16ms into 16.6666 ms for example which I assume will be fine but I wonder if the leftover half MS every frame ever causes issues...
Hey I have a really basic question
What gives a multiplayer (In blueprints) the functionality to operate two or more players using one set of blueprints? how do i, for example, give each player their own health?
you replicate the health right? do I assign it to multiple player controllers?
players don't know about other players' controllers
usually you have a pawn, with health, and that's replicated in the case clients need to know each other's health
I feel like given your question you are not too familiar with the basic concept of multiplayer and how it work in ue4, you should read this document https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
I have a "ContainerComponent" that does server RPCs. This works fine on my players, but on a replicated actor (Chest) it fails as that actor never hasAuthority.
I've tried setting the owner of the chest to my player pawn both through an rpc and locally and it still doesn't work.
How would I go about getting the Chest to be able to call these RPCs? (I.e. the server RPC should show them as HasAuthority true inside of the server RPC)
For now the only way i know how to do this kind of things is by using a owned actor to make the rpc call to the server
Oof, Thanks. i had a feeling, though that is awkward to me. I want my ContainerComponent to do its thing. having to put RPCs for it in the pawn or PlayerController would ruin the Separation of concern and make it very awkward to extend anything unrelated to the player that needs to actually replicate functionality
it is awkward for me to but i don't know any other way right now
From random things that I'm reading, calling SetOwner from the PlayerController/Pawn on the server for the actor should work. I wonder if anyone else has the answer for us
never tried but it doesn't really solve your problem since it will work only for one player at a time and to make the switch you need to call a RPC to the server anyway
Well i can lock the container to one player at a time. I should be able to do the switch when I interact with the chest from the player (trying to debug what's happening with this method now)
yep but that mean two player can't interact with the chest at the same time
@wintry forgeI solved that issue by always using the local player's inventory component for the RPCs. Client component does server RPCs, server version of it does distance/other checks, and does the transfer code. Then your client's inventory component, which I had mine on their character, does all of the inventory interactions, which works because that client always owns that component.
If you add some extra data to your RPCs, you can solidly allow multiple people to use the same chest at once, and the changes just get replicated back to everyone.
@kindred widget Thanks for that, I suppose I can change all the container functions to always interact with an "external" container component/its items (and always do the calls from the player's container passing the target container through. or make some ContainerInteractionComponent that only sits on the player and does all the interaction to the container
My usual RPC had FromContainer, ToContainer, FromSlotNumber, ToSlotNumber, ItemID, DesiredAmountToMove
Allowed me to write some pretty generic transfer functions by having both containers. The ItemID was to check if the item was the one the player wanted to move, just incase replication was slow for some reason.
Good solution
Currently I'm calling a server RPC on my widget and if I get the widget's owning player controller, it doesn't have authority. Which shouldn't matter as I'm using the player's inventory Component to interact (as you described, with a server rpc too) Where do you call the components functions from?
widget are only present on client so you can't call rpc on them
Thanks (wish this would show as errors in the log) I'll need to figure out why my component's RPC still isn't working though
you need to check your component as replicated
Is there anyway to remove the 'sweeping' of teleportation when teleport an actor?
Edit: by sweeping, i mean that the actor is moved to the location in a smooth movement, not instantly placed.
I have setIsReplicatedByDefault(true) in the constructor and the items in it are correctly replicating from server to client
I think when you set an actor's location you can pass a bool to set if it should teleport to that location, otherwise replicated movement will try and interpolate the positions not sure if that helps at all
So i have the same problem, except i noticed that the server will work fine and update the when in PIE, but if the client is in PIE and server in standalone, then it doesn't update the client... And either way the local roles don't change when I call from doThing() to server_doThing . the RemoteRole is authority but local role is autonomous proxy
Its seems you are working in c++ maybe you can ask in the cpp channel some help maybe there is a nuance not present in blueprint
Hey guys, how would you implements an inventory system with states for the items (like durability, water level for buckets) that would be replicated? As UObject are not that easy to replicates, how can i have differents state classes for the differents items and still be able to replicate it
Replicating UObjects is fairly easy, you just need some component to replicate them as their subobjects.
You also can write custom replication for this.
If you always have some values you also could use a general Struct that keeps a generic value which is interpreted differently, but since "Godobjects" should be considered evil, I think you want to go with inheritance => UObjects / custom replication.
Maybe as a first shot use UObjects and checkout ReplicateSubobjects
You can use struct also
So you would recommand me to have something like TArray<UItemEntry*> and implement custom replication ?
The issue with struct is i canβt subclass them and use differents « stateΒ Β» types
Well you need custom replication, if you don't use UObjects and ReplicateSubobjects.
If you want to use custom replication, you can use UStructs and store them as TArray<TUniquePtr<FMyStruct>>
Is it possible to use ReplicateSubobjects with a tarray?
well you basically just use UPROPERTY(Replicated) on the array, and then you need to replicate the actual objects, by implementing ReplicateSubobjects
since the Replicated on the array will just resolve the pointers basically
the objects them selves are then replicated by this subobject thing
that's why I usually prefer custom replication^^'
why would i even use pointers to structs for replication?
if you don't inherit TArray<FMyStruct> is perfect match
If you have different subclasses
don't think that that scenario is a little too complicated to serve them to someone who doesn't even know where to start?
I just summed up the possibilities I have in mind, with the hint to start with UObject replication.
i find fastarray to be a better choice for anything but the most basic replication
π€·
fastarrayreplicaten still requires you to have smth that replicates
so if TArray<FMyStruct> or TArray<UObject*> is not working, fast array won't as well, if I didn't miss smth the time a checked the implementation.
fastarrays main advantage is per item client side callbacks
something without i'd find the inventory UI pain in the arse to make
yeah, I know^^ I implemented smth similar for some specfic stuff, but still, this won't help you, if you don't have smth that replicates as is
it will generally replicate structs in item array out of the box, subclasses take a little more work
same as tarray
so we are where we started^^ we either need custom replication, a godobject or ReplicateSubobjects with UObjects
the replicate subobject be the simplest method here
yep, as I stated at the beginning ^^
@quasi scroll to replicate subobjects, you just need to override the objects IsSupportedForNetworking to return true
and in the actor that handles its replication override ReplicateSubobject function
i see thanks!
bool ASolsticeGameState::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
bool bWroteSomething = false;
for (UBotStatus* BotStatus : TeamBots)
{
if (BotStatus)
{
bWroteSomething |= Channel->ReplicateSubobject(BotStatus, *Bunch, *RepFlags);
}
}
bWroteSomething |= Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
return bWroteSomething;
}
example of the 2nd one
same for a component btw
component has a caveat though
it will swap out the outer to its Owner on replication
even if it was set as the Outer on server when the object was created
does that matter? either way the outer is the actor
if you do NewObject<USomeObject>(this, ObjectClass);
when instantiating on server from the Component
Component is the Outer on server, but its Actor owner is the outer on the object that replicated
little landmine by Epic
ok, so as long you don't assert on ownership, it doesn't matter since lifetime is the same. But still a good point, didn't know that^^ thx π
@quasi scroll i put the Super call below in that function, so that Subobjects replicate before the member variables
if it was the other way around, OnRep_TeamBots would not have the BotStatus objects yet, it would just be an array of nullptrs
thanks so much for these informations 
if (const UBlueprintGeneratedClass* BPClass = Cast<UBlueprintGeneratedClass>(GetClass()))
{
BPClass->GetLifetimeBlueprintReplicationList(OutLifetimeProps);
}
and that goes into GetLifetimeReplicatedProps on the object if you want blueprint variables to replicate
Does anyone know when/how exactly network relevancy is tested?
If I make an actor dormant, or give him a very low netupdatefrequency, under what conditions does it test whether he should replicate to a player?
relevancy != dormancy != netupdatefrequency
Relevancy is done by distance, so if viewer is outside the net relevancy range, then the actor would not be relevant
Dormancy determines if the actor should replicate or not. Awake = Always replicate, Initial = Replicate when loaded from package, but only once then go dormant, All = Dormant to all connections - Does not replicate, DormantPartial - Dormant to specific connections = Does not replicate to ignore channels.
NetUpdateFrequency is how often the engine considers a non dormant actor for replication for a connection.
Right... but if you imagine that at some random point, IsNetRelevant returns false for a player, what I'm wondering is when is it next called for that player?
its called every time its considered for replication
as long as the actor is not dormant
which, if dormantAll, is never again?
Hello!
Question, i have a mob BP that is replicated. Like every character I have to pan its mesh with half the height, because the capsule and the mesh are not on the same origin
Because the height depends on which mob it is, the resulting panning will be different
I use SetRelativeLocation in my BP to set that offset
The issue, is that because of network compensation, as much as it works on the server, the client cannot use that node.
Any idea of how I can do it differently? Being able to set offset on the client
youve already kinda answered my question... basically, the NetUpdate(through frequency or forced) does a NetRelevantFor each player
also @meager spade to make this
https://www.unrealengine.com/marketplace/en-US/product/player-pods is it hard? But i check what i am doing but must i make 5 player spawns on all pods?
NetUpdate does not function does not work if the actor is dormant
you need FlushNetDormancy if it was dormant
true, but ForceNetUpdate does right
no
ah wait
yeah it does actually my bad
{
if (GetLocalRole() == ROLE_Authority)
{
// ForceNetUpdate on the game net driver only if we are the authority...
UNetDriver* NetDriver = GetNetDriver();
if (NetDriver && NetDriver->GetNetMode() < ENetMode::NM_Client) // ... and not a client
{
NetDriver->ForceNetUpdate(this);
if (NetDormancy > DORM_Awake)
{
FlushNetDormancy();
}
}
}```
it calls FlushNetDormancy
ahh, beautiful
so if my conditions inside IsNetRelevantFor changes(on the server), i can use forcenetupdate on the server version
to make sure its replicated to the now-relevant player
sure
thanks!
I want to add sprinting for my game but don't know what I need to override/add in my character movement component can someone give me some direction?
I think it's the replication that does it. since it's a multiplayer game. I'll see if I can figure this one out.
that doesnt work because I keep getting it correcting itself on a dedicated server (I'm writing in C++)
@meager spade So again about the lobby and the player pods. I would make it so a pod this can then get a character. And if a joint spawns he simply there. is that the way?
You need to change it server side
@brazen sluice why isn't that offset just already set in the BP editor? Are you using different meshes at runtime?
So a mob is NOT a subclass, it's just an instance with different mesh chosen at runtime?
Yes correct
Are all the meshes the same height or are they varying heights?
Varying
(I also have the same probelm when I have a held item and they have different offset depending on the item)
One way or another you need to calculate or store the mesh height. After that just set size based on mesh height and mesh position to be -Height/2
I author all items with origin at grab point. So grip for guns etc
I have the mesh height stored that's ffine, the issue is the client cant apply the offset
But I subclass BaseItem for each Item and can manually adjust position if need be
because network compensation revert it
Apply it on server and it should replicate out
Assuming you have component replicating etc
Well it doesnt π
The movement are replicated but the offset is missing
the mobs are in the floor
It only replicate if I set it in the editor
Do you have replication enabled for the mesh component?
But not with SetRelativeLocaaiton
@brazen sluice how many different mobs do you have?
X numbers, it's moddable
Right now I have like 6
( so presetting it is not really an option)
And how do you get the mesh height, from a data table? Or do you calculate it from bounds
From data
Just apply it in the construction script
Will it work on client as well?
Also will the data be replicated already?
Client needs replicated data to know which mob it is
First double check that you have the replication settings correct. Should be able to just replicate the position of a mesh inside the actor. Do you have component replicates checked for the mesh component? And I'm assuming you have replicate movement check for the actor?
Checking!
Movement replication was checked but not component replicates
I'll try with that one on
I just need a sec because the game is crashing right now when client connects π
Is there a way to change between offline and dedicated? Wen want to create the character without any replication to server, after creation we want to change to multiplayer. Is there a good solution for this?
How do I run the server without launching the game? Every single one of these commands runs an instance of the game alongside the server
Just curious, if you have a very big level in a multiplayer game. Is there some equivalent of level streaming that works in a multiplayer game? Or a way to avoid loading the entire map into memory?
Anyone else had issues with rotation on attached actors? I'm attaching an actor and it does not follow rotation of the "parent" actor.
edit: it's only for the attached actor client, the other clients see the rotation just fine.
Where would you initialise HUD widget related to a pawn ?
I use to init them in the controller. Not sure if it's the right way, but it's working for me.
The HUD is dependant of which pawn i posses
@pastel marlin Controller has an OnPossess node, do it there
OnPosses is run on server only if i am not mistaken ?
Then have it repnotify a HudType variable or call an UpdateHud event
Am I guaranteed that if I call a rpc In OnPosses when the RPC arrive on the pawn its controller will be set up ?
Not sure. I know there's some way to have an event fire when everything is settled in but I don't recall where or how
https://forums.unrealengine.com/t/why-is-there-no-on-possessed-event-for-client/70355 I'd look into that
Unreal Engine Forums
There is this big gap in ue4 framework due to which there is no way to know when a pawn is possessed on a client reliably at that exact moment! I want to run a function on client as soon as the pawn is possessed by a player on start of the game. The PossessedBy event is fired only on the server that too long before the client version is even s...
looks like AcknowledgePossession is a thing too
https://stackoverflow.com/questions/55076751/playercontroller-possess-vs-acknowledgepossession-vs-setpawn
SetPawn() is the best place IMO
Using that in CPP and never had any problems with pawn possession
SetPawn is called once both pawn and controller have acknowledged each other, so shouldn't be any race conditions there.
They're looking for a notify when pawn is changed clientside
SetPawn is called client side
If you really have to use BP for a multiplayer project then yeah I guess π
I use BP all day every day lol. Love it. Not really shy of doing stuff in C++ but I prefer BP.
I don't like BP but I hate the compilation time of cpp on my pc π¦
thanks adriel and jambax I will test the solution you have given
Anyone have any suggestions what I managed to break this time? This is on my local dedicated server.
something like the location of the vehicle is not replicated
check what you have changed last time before its broken maybe some events
Using Physics? Welcome to hell.
haha
Server and client are out of sync, you're getting replicated updates about the position from the server back in time, so client keeps snapping back to old server position.
Should use client-authoritative physics if you want vehicles
I'm of the opinion that if you're trying to do multiplayer physics, you should implement your vehicle from scratch instead of using the provided template, so you know what exactly can fuck up and why it might.
this is using chaos vehicles and letting clients decide is not really an option
Server authoritative can work fine, and is the only way to do it if you don't mind the lag but want accurate collisions between vehicles
It was working just fine for the last 6 months
It's the only options if you're using physics
No it's not, I have server authoritative multiplayer physics and it works just fine.
You've probably never tested with different client/server tickrates and/or latency before I'm guessing.
I usually test on a dedicated server in another country
was working fine there
this is locally
I have, from different computers. I fine tuned the physics replication settings tho and I do NOT do any prediction.
server running on my pc
and I do NOT do any prediction that's the big difference
Server auth and no client prediction = input lag
Client prediction and server auth = sync issues
well yeah, what happens with 2 client authoritative vehicles collide? Input lag is fine for my project, it's slower paced like rock crawling and tanks and such
I am most concerned with everyone agreeing on the state of the world rather than split second responsiveness
We use server auth with no prediction in HLL only because we have to but alos as vehicles are slow, but for games with faster vehicles the lag isn't really tolerable on a real-world connection.
Even CMC has trouble with client-client collisions
Although in my case the only thing synced is the major transforms of the chassis and movable turrets. In my case the vehicles are player-constructed like Kerbal Space Program so there's no sane way to predict their behavior.
okay seems something is up with my editor
if i lock the framerate at 128 ticks its smooth as ever but it behaves like its running at slomo
:S
I have problem with movement when 2 clients riding same vehicle the passenger see different location for the vehicle
the location of vehicle in driver screen going normal on the road but in passenger screen going beside the road or falling under map
ok its defo running in slomo :S wtf
@cunning condorI'm just curious, what was your vehicle solution? was it a pack on the market place?
It's chaos vehicles
building 4.26 from source
it's super buggy and crashes if you look at it wrong but the simulation is pretty good
though we spent some effort expanding it so we get more granularity over the variables during runtime
Oh, chaos
now I just gotta figure out why my editor is behaving like it's set to slomo 0.2
Hopefully they sort out Chaos in UE5.
oddly enough if i manually set slomo to 2 things run at normal speed, wtf is going on
Hey guys, any reason why the player on server spazzes out so much when im spectating a client's actor? I used set view target with blend to spectate the other actor. https://gyazo.com/cd911996ce32f29d1323cdf9aa53a1c7 It also happens on the other client, but it's not as bad :/
You'll probably have to show the blueprints where you implement deltatime into the calculations, but then again I'm still a beginner @cunning condor
like it's behaving as if the entire simulation, not only the cars, are running at slomo
so its not specific to the cars
if i drop an actor its falling at 0.2 * normal speed
even the camera blends are running at slower speed
look into substepping?
currently disabled
substepping might fix it.
I've only played around with it a bit when I was doing my car project, it seemed necessary but that wasn't with chaos physics
substepping shouldn't affect things like camera blends or sequences though right
Not sure.
If the camera is somehow tied to the rotation and movement of the car, it might?
we're not talking about the cars
particle effects are also simulating at slower speed
literally the entire editor is running in slow motion
FPS is solid
the rendering time is like 8ms atm
yet the entire editor is running in slowmotion
if you wanna get an idea of what i'm talking about type slomo 0.2 in the console, that's how everything runs atm
despite slomo being set to 1, so something funky is going on with time dilation
Hey,
Question about replication.
One Client has a VR connected and because of that, I'm spawning a pawn with "VR" enabled.
Another (Server) does not have a vr connected, so I spawn a pawn with "VR" disabled.
Now if the client connects to the server, the server doesnt know that the client is using VR and so he spawns the pawn with VR disabled.
Now how can I replicate this information (Client is using a VR Device?) Should I store it in the PlayerState? PlayerController? Do I have to make a specific setting?
Why do you need to differentiate pawn into vr enabled or not?
What happen if I have vr connected but want to use regular pawn?
if you use a vr device and a regular pawn, it will now have proper tracking of your motioncontrollers.
Also if you have no vr and a vr enabled pawn, it will not properly track your movements and camera rotation
So you have 1 pawn but have different event/components base on what config player has right?
If that's the case, player controller seems a better place to hold the config
Since client have direct control over it.
In general, remember this simple rule, replication only happens one way from server to clients.
so the best bet I have is sending a RPC to the clients, asking about the vr state and then them sending an RPC back with the vr state and based on that, spawn the pawn?
So it's more like this, the player controller is mirrored on the server
When you connect to server you can query the controller (which pretty much represents player themselves)
Eventually when the server spawn the pawn that replicate to other clients, they can be spawned and set pawn config/flags properly
If you follow that simple rules above it would be more straight forward for your dev decision making.
Anything must happen on server for other clients to see that happen.
Hey, I'm having a major hitch on an issue with replicating FSplineCurves, or any struct that may hold FQuat information. The NetSerialize on this is getting to an ensure on Q.IsNormalized and hiccuping every time, then runs fine after. Wondering how to fix this?
Not sure why this is an ensure, engine level, when it immediately just runs Normalize on the Q if it sees it isn't normalized. My struct then replicates fine, everyone gets their info, it's all happy... But I have this nasty hitch the first time it hits that ensure.
Using the debugger, it appears to be on the Arrive Tangent, when I'm replicating SplineCurves as a variable to be able to load up a modified spline for connecting clients.
where?
because if you're testing in editor at least one of your clients has a mouse off screen
if your spline has to do something with that... it will come off weird
likely you have a bad init or no init Quat though
I have "FSplineCurves SplineCurves {}" in the header, I believe this makes an empty struct?
I can load and recreate a spline actor just fine, so saving and storing SplineCurves is working; but I'm having an issue replicating it, server to client, so that joining a game mid-session and getting that data from the server makes a Spline actor for the client
ensure fail log
here's the server's log
after this hiccup, everything is totally fine and the client receives the SplineCurves and updates its meshes and the spline is fine
but I cannot find a way to get this ensure happy; I'm just saving and storing the SplineCurves variable server side, then letting it replicate to client, and OnRep with that variable I run an update on the spline
so, FSplineCurves doesn't appear to have a default constructor...would that potentially be a problem? It's uninitialized and it's trying to replicate a struct without any initialization?
I have isolated it to specifically having an FSplineCurves variable set as replicated in an Actor
Try debug the server first and see how the values done and when the replication triggered that cause those error log
the FQuat comes up with a W of 0.5
it is initialized
it trips the ensure on Q.IsNormalized()
which, ultimately just leads to normalizing
I'll attach the debugger to the server now and see what pops up
yeah it trips on line 859 of UnrealMath.cpp
if (!ensure(Q.IsNormalized()))
this = {FQuat *const | ...... } { x = 0 Y = 0 Z = 0 W = 0.5 }
ahhh Q is supposed to be set to a dereferenced this...I see
no, there's nothing I can tell
it's just running FQuat::NetSerialize and hitting the ensure on IsNormalized
Remember that ue4 is multithreaded. You might run into situation where sever spawn an actor and replication thread run on incomplete actors(where their properties aren't really at the value they should be yet.)
I don't know if there is safe guard against that but I imagine more checks means more overhead and the developer are suppose to manage that part.
So if you seem stuck at finding out the reason, try also monitor when the replication doing its stuff and what values it get.
I have isolated it to specifically anytime I have a SplineCurves struct replicating
so it's definitely that
it's on tick
in the stack
I've totally removed any OnRep functions
I would also back trace from the error message (so break on the error log and then see what call stack is calling it)
isnt ue4 replication single threaded?
Then cool.
I'm not sure what you're saying
I do not know if entire replication is run on single thread.
It's just that I run into issues before that are cause by different events firing asynchronous.
So I wouldn't assume anything running single thread.
I remember a stream where they said single thread
let me find it rq
(except like maybe game mode)
there's nothing replicated about a game mode
and the game mode runs on the game thread like all other actors
it's literally just hitting an ensure when trying to replicate the FQuat info in the SplineCurves struct
nothing else is triggering the issue
there are no nullptrs, everything is wrapped with "if" statements; it's just the tick for replicating actors
Cool, yeah like I said, I don't entire know, but I don't assume something is running in single thread and thus my execution order are what I imagine it to be.
This week we'll be joined by Ryan Gerleve and Dave Ratti to discuss general server optimization in UE4, as well as techniques and solutions to improve your Actors' performance in a networked environment.
NEWS
Unlocking Breachβs combat with Unreal Engine
https://www.unrealengine.com/en-US/tech-blog/unlocking-breach-s-combat-with-unreal-engine
...
@silk abyss
if u go to 55:19
Cool thanks.
Thread-1-[Main Thread] is what's running the FQuat::NetSerialize()
it doesn't make sense to me why they put an ensure with the Q.IsNormalized() in the engine if they're just about to normalize it anyway
it causes a hiccup, and then just resolves itself, and it's never hit again because it's an ensure
Lol, see all the past multiplayer games all have jerky physics actors here and there.
the full function eventually even outputs bOutSuccess = true
so it even resolves as successful
but causes a massive thread hitch
actually...NetSerialize can't return anything but true
Maybe try comment it out and normalize yourself and see what happens. (That's my stupid hammer method just to observe what happens)
Yeah, that's too deep for me engine wise.
Maybe you found something and can send a pull request later.
so...with a quaternion
is it normal to see a quat with a w of 0.5?
is there a math channel on here...
There should be a answer you can find on the math stack exchange
But it is normal to normalized a quat since some operation don't return normalized result.(I do that all the time in Houdini VEX)
it's deep in the struct, not sure how efficient it'd be to go through all spline points and try and run normalizations on anything resembling quats
And on Houdini, quaternion is {0,0,0,1} (identity? I don't know what that calls in quat sense)
Like maybe a lazy way to make sure normalization is always triggered from new quat?
a standard if would trigger the normalization just fine
the use of the "ensure" makes it log out, and then causes the thread hitch
but ensure also means it only happens once during a run
so when it encounters this again, it just skips, normalizes, and everything is happy
So the ensure throws exception then so the log function catch it? I am on the phone so all I can do is guess.
and causes a 7 second slowdown in everything...but after it's done logging and proceeds and normalizes the FQuat everything is fine
Can you somehow put in a properly initialized quat before it hits that if?
it's an engine struct
FSplineCurves
there's no moment where I can go in and normalize stuff
So anytime you create that struct it runs that part.
and as far as I can tell, it's the default initialized struct that throws this
Lol, open source development for you. :)
the hiccup occurs right when a client logs in
the host/listen server never encounters this issue
and it's when I have a spline actor that has added an additional spline point beyond the default
Join lag is a thing though and really common for UE(be it 3 or 4)
yeah, I have successfully maneuvered around waiting for things to replicate
but now I'm having the problem of this dumb struct issue
π hope I will read some blog post from you in the future.
ha
well I livestream all this actually, I'm in the midst of just having a headache and banging my head against a wall on twitch π
Most company just write it off as it doesn't impact the game that much as join mid game usually means it's casual queue
a seven second hitch during the initial run is painful, but yeah, I could hide it with a load screen I guess
So the hitch happens on the client that joins? Or all the other existing clients will have this lag as well?
Cause 7 secs for the new client is okay
the whole server hitches
For everyone, good luck!
yup
and only the first time, because of the ensure,
everyone else who joins...no issues
the Normalize goes on, everything works
and if the client leaves, and rejoins, because it's an ensure, it doesn't ever do it again
just really dumb
Can you like start a fake dummy client that joins and then quit on the server machine?
I think I've found what may be occurring
I'm not sure why, but somehow Spline Point 1 has an FQuat for the rotation as 0,0,0,0.5
even though FQuat::Identity should be 0,0,0,1
I don't know where that 0.5 is coming from, and that's what's throwing the IsNormalized function...so I'm trying to hunt down where the w = 0.5 is first occurring
Someone hard coded that part I assume. ;)
it's when a point is being added it looks like
on spawn, the 2 default points are 0,0,0,1 for their FQuats
getting closer...
Gonna go walk with my son, will check back later. Hope you have a good solution then.
thanks for sticking with me, have fun
I need to walk soon too >.<
UpdateSpline() leads to Rotation.AutoSetTangents() which triggers w = 0.5
which then leads to triggering the false on IsNormalized()
so I'm going to set "false" for update spline when adding a new point and see what happens
haven't solved the problem, can't seem to Normalize or reset the Arrival and Leaving Tangents W value back to 1 after it's stored as 0.5; I'll continue on it tomorrow...but that is the issue. When you UpdateSpline() it goes through and auto sets the tangents for the curves, and then that screws up the IsNormalized() for replication
Hey guys!
Am trying to retrieve PlayerState from Pawn but it keeps returning me null. Am trying to achieve this from the Server.
If I grab the PlayerState but from the Pawn's Owner (which is a PlayerController), it works just fine.
Is the pawn possessed by a player?
Yeah it needs to be possessed by the controller in order to set the player state var
What happens if 2 different players sent a server RPC at the same time to take the same power up actor from game world ?
will it cause the power up to be duplicated? how to handle that? or u don't have to ?
@lament sinew One RPC will be called after the other, so it's entirely down to how you implemented it really
Is there a way to Add Force through a timeline to a Server that doesn't result in stuttery movement for the client?
does anyone know if I am suppose to have gaming logic inside the game mode? like for respawning players and things like that?
is it necessary to have HasAuthority() checks everywhere ?
When is it not necessary and when is it not ?
Besides from the fact that you already know you are server and that you want to do that thing on client side only.
I think you answered your own question
No clue. Test it (:
kinda not the same answer if its running solitaire or a FPS
Yeay we can't really answer that. Depends on your project
Even if you label the genre we probably can't answer it
You will have to go through some testing for this. Dedicated server stuff isn't cheap. Testing what servers you need, specially under heavy load, is part of the expense
That's why bigger companies have stress test weekends
hello
anyone who can assist with replication?
TL;DR
PlayerController calls GameMode -> GameMode assigns PlayerController to a team. GameMode then tells PlayerController which team he belongs to.
PlayerController then tells PlayerState which team he belongs to.
PlayerState on the server is aware of this, but PlayerState on the client side has no idea,
PlayerController:
{
Super::BeginPlay();
AGameModeTitan* GM = GetWorld()->GetAuthGameMode<AGameModeTitan>();
if (GM)
{
GM->AddPlayerToTeam(this);
}
}```
GameMode:
void AGameModeTitan::AddPlayerToTeam(ACharacterController* CharacterController)
{
if (CharacterController)
{
int32 Index = 0;
if (Teams[0]->GetTeamMembers().Num() > Teams[1]->GetTeamMembers().Num())
{
Index = 1;
}
Teams[Index]->AddPlayerToTeam(CharacterController);
CharacterController->SetTeam(Teams[Index]);
}
}```
PlayerController:
{
ACharacterState* CS = GetPlayerState<ACharacterState>();
if (CS)
{
CS->SetTeam(Team);
}
}```
PlayerState:
```void ACharacterState::SetTeam(ATeam* NewTeam)
{
UE_LOG(LogClass, Warning, TEXT("Setting Team on State! %s, %i"), *GetName(), NewTeam->TeamIndex);
this->Team = NewTeam;
}```
I had a full head of hair before attempting this....
Might not be a solution for your problem but you could put the team variable in ACharacterState as a replicated property
yip, I've done that
ATeam* Team;```
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ACharacterState, Team);
}```
and its not replicated ?
nothing. Team on CharacterState stays null
does it matter than ATeam object is of type Info?
I think, that only AActor is replicated...
It might be I don't know what type info is
Info, the root of all information holding classes.
lol
"...but might need to be an Actor for replication purposes."
screw it, it's becoming an AActor
π
the object or the variable on PlayerState?
the object
Was wondering if someone could help me with understanding a couple of MP concepts. I think I'm missing something fairly simple here.
What is the difference between calling OpenLevel 127.0.0.1 and ServerTravel MyMap?
And where do sessions fit in this? Are they needed at all, or do they add something to the process?
Not sure what OpenLevel does but Open will connect the local client to a server with specified IP address.
ServerTravel on the other hand will change the server level. Note that this have to be called server-side
Sessions are not needed in this case
Ahh. So are sessions only needed when you are trying to connect via steam or similar subsystem?
Or maybe my question is when do you typically use sessions?
I only used them for a server browser. Not sure if there are any other use cases
Sessions are basically just information holders. If you know the IP of the Server you want to join, then you don't need a session. But if you need information about a Server being available to others, then a Session would be needed.
A session is not required to play multiplayer. It encapsulates the information of the Server.
Some of those information are or could be:
- IP Address/Port/UniqueID to connect to
- How many users are part of the session?
- What map is the Server playing?
- What GameMode is the Server playing?
- Custom information about your game, like standings, time of day, day until wipe, etc.
While they are mostly used for Server Browsers, where a Master Server is used to register sessions and then query them, they can also be used only visible to the backend, mostly for you as the dev to keep track of ongoing matches.
Think about Fortnite, Overwatch, Rocket League, where you only press a button to find a match.
This will perform matchmaking in the background and then join you into a session that you aren't really confronted with as a player.
OpenLevel or Open, vs ServerTravel is what Thompson more or less said.
A Server can only host one map at a time. ServerTravel moves the Server and the Clients to the new level.
OpenLevel or Open, with an IP, is basically a ClientTravel (in code), which connects to a Server, or opens a level if passed a map name.
There is a difference in Traveling called HardTravel and SeamlessTravel.
Usually all ClientTravels, may it be connecting, disconnecting or just moving between levels, are HardTravels.
They do not persist any data (+- GameInstance). ServerTravels, by default, are also HardTravels, but you can change the given GameMode to perform a SeamlessTravel in its Default Settings.
SeamlessTravel is preferred at all times and also required for Steam. A HArdTravel would cause Clients to disconnect and try to reconnect after a short delay. SeamlessTravel will send the Clients to a small TransitionMap, while the Server loads the new map and then the Clients follow, staying connected throughout the process.
There are also a bunch of default persisting Actors, or at least method that allow you to persist information between maps. Such as PlayerState and PlayerController for Settings and Stats.
You can also persist your own actors but that requires C++ iirc
wow - thanks for the detailed explanation.
I think that makes sense - in my scenario I want players to move to a "lobby" level, choose characters and then "ready". When all "Ready", move all players to the Map.
So that sounds like Open "Lobby", Choose Characters, Server Travel -> Map
No sessions required if IP addresses are known.
What would you do if your character to spawn logic is set to a perm variable but itβs not inside the game instance? How would one call a perm local variable to a character select widget?
That sounds correct
Just keep in mind that Lobby to Map should ultimately be a SEAMLESS Travel.
And SEAMLESS Travels come with some extra stuff, like PreLogin, Login and PostLogin won't call.
It's important that you learn which events call for both, connecting and traveling. etc.
It's HandleNewPlayer as the entry point?
That should call for both, yes
You further have OnCopyProperties in the PlayerState and OnSwapPlayerControllers in the GameMode to move data between old and new PlayerState or PlayerController
E.g. you can save a character selection in the PlayerController and move it over in the OnSwapPlayerController function
Oh, it'll copy across?
It's a good idea to have a base class for Lobby and Game GameMode/PlayerController/PlayerState that shares those fields
It won't, but it allows you to
basically gives you old and new PlayerController/PlayerState
so you can take values from the old and set it on the new one
Ah right
I don't understand the question tbh
Anyone have solid experience with any Backend as a service products? I know Gamesparks and Playfab used to be the big boys but from what I understand, Gamesparks is dead and Playfab isn't looking so hot. Looking at something like AcceleratXR or Braincloud, but not sure if there's others I don't know about
Hm, I worked with both GameSparks and PlayFab and I would assume every other service is exactly the same hot mess. They also quickly get very expensive. Sadly don't know about AccelerateXR or Braincloud, but if they are similar to GS and PF, then I doubt they are much better. They all come with downsides and expensive limits.
For a serious approach I would probably suggest setting up the service and backend by hand and only renting the naked servers wherever it fits.
When you say setting up service/backend by hand, are you saying do things like matchmaking, shops, etc. yourself? Or saying use one of those services, just don't rent their servers?
Yeah I meant all the services. I fully understand that that's not an overnight job and needs additional peeps to maintain it, but then you can at least make it work exactly like you need it and don't pay for weird limits that other paid service force upon you
Yeah pricing it out definitely was expensive. Came to $8k a month for just 5k CCU on one services, and that wasn't including server costs, was just for the BaaS. Makes sense, appreciate the insight
If that's not an option due to a time constraint or so, then well, not sure how much of a difference it is to choose one over the other. GameSparks and PlayFab are both bought buy huge companies and are supposed to be the top ones, but the problem is/was that after being bought, these companies wanted to fully change both of those platforms.
Which caused them to basically be set back to square 1. They stopped developing their own systems and made new ones.
You also have GameLift, which is for Serverhosting, which has some Matchmaking service, which I forgot the name of
But they are all equally expensive. They lure you in with free tiers for testing, but that's about it
Not saying that your own system is much less expensive, but then it's at least up to you to scale it
And GoogleCloud or so was also something someone asked me about recently
Or GoogleCloudGaming or so, not sure what it was called
Yeah AWS completely dissolved Gamesparks just for reference, its 100% gone. Playfab is on Azure now but it's been fully Microsoft'd at this point. I'm guessing there's some breakeven point where BaaS saves you money until you get big enough where "damn I should have just spent this last 6 months of bills paying someone to do this ourselves". Good problem to have I guess. Fortunately, most do at least seem server agnostic, so any of these companies like Improbable/Multiplay are still usable to manage infra on whatever BaaS works I guess
Wish EOS came out awhile ago, just feels too new still.
has anyone ever implemented kill cam with DemoNetDriver and InMemoreyReplayStream ? there is not document and I am stuck
πΏ
what is the official reasoning behind TMap and TSet not having replication support?
I mean Tset you could still do with an array and just implement your own checks
and for TMap
You could have a struct with the two values in an array
and make a function again do similar things
well I have workaround for both of them , I'm interested in hearing the technical explanation for it
In seamless travel, do I need to manually destroy the persisting playercontroller after the playercontroller swap happens?
No
As far as I know it has to do with it not being very efficient
At least the TMap one