#multiplayer
1 messages ยท Page 153 of 1
Not really?
Right, it also has better debug visuals ;)
There are some examples in their blogs. Iโve reached out for an evaluation license so I can see what the code looks like. Iโm only really interested in the fixed net simulation rate as well as the render being separate from that sim.
Yeah it might be useful. It's however always a bit of a gamble to rely on too many third party solutions
NPP even has that but you would need to implement the local interpolation yourself (as it is now)
does it work for physics prediction too?
How can i play enter & exit animations in a passenger vehicle? the anims can only reference one character at a time & idk how to pick the right one eather
show what you're doing
there is nothing special to show. setting character ref when interacting in the vehicle bp and playing montage on that mesh. The issue arises when there are more than 1 character. Not sure how to make it for multiple characters
well you'd need some RPC on the interacting character for the interaction, no? RPCs only work on actors that the players actually owns
Do I need to use APawn::OnRep_PlayerState() to get the playername from other clients? Since AGameState::PlayerArray doesn't have an OnRep function, I tried to create my own replicated playerstate array by overriding AGameState::AddPlayerState and AGameState::RemovePlayerState but newly joined player's name doesn't seem like it's set yet when my custom array's OnRep function runs on clients
getting in is not a problem. it takes the ref of the character that interacted last. but when trying to exit it doesn't know which character to reference
why is the vehicle the one reponsible for this?
and I'm sure you have individual seats right?
no i don't. I just have a passengers array & attaching the characters to the vehicle
So apparently there is APlayerState::OnRep_PlayerName(), I'll override that to brodcast an event to let the UI update when the actual playername is received
does the Event Tick get called on both server and client?
yes
just like any normal function
so if im running some physics calculations (various add forces) and i want the server to be the one calculating all the physics, can i simply use a Branch with Is Server as condition?
Yes, or HasAuthority (not entirely the same, but for a replicated actor it would be true for server)
i see, thanks!
It wasn't, this is what was happening #multiplayer message
I'm wondering what would be required to make a seamless hosting option.
E.g. player is playing a game, decides to allow a friend to join.
Minecraft does this by ALWAYS being a server, and only opening communication when asked to.
As far as I can tell unreal requires that the appropriate networking interface is prepared when setting up an online world, so I couldn't start a world in singleplayer, and then subsequently simply "open" my game to the network without doing a "UWorld::ServerTravel" at the very least.
Am I missing something?
You'd need to open your game map using the listen argument (open YourMap?listen)
It'll start a listen server
You can probably run that in single player and just prevent connections until you open up, but I don't think you can switch from fully standalone to a listen server on the go
But that requires the appropriate networking stack be booted at that point, yes?
Depends what you want to use
You will need to be connected to EOS, and then you can open the map with ?listen
Then if you decide to open up to players you can create the EOS session
@zenith parcel
If you are offline at the time of starting the "server" it will probably not work
Thanks @solar stirrup thats roughly what I had surmised.
It will however, work just fine and its a small usability hit for the benefit of making the process seamless-ish
You can start as a listen server
Just have single player = listen server
What I said 
Well now I know TWICE AS HARD.
Thanks guys, appreciate the help
hi, if I create a dedicated server with the unreal source build, is there a way to find that server on the clients like FindSession? Ik that I can join by typing the specific IP address but if there a way for me to browse that?
hello, I have a simple beginner question:
Is there any high level difference between implimenting client/server communication when it comes to dedicated server vs listen server?
I'm trying to figure out how I should think about multiplayer when I'm working with blueprints. Even with listen-server, should I logically treat it as though every client is just a client, and the server is a separate thing?
I'm confusing myself because with listen-server, one of the clients is also the server.
Nope - the server is also a client
You'll have to be careful with that, there's some pitfalls in logic
On a dedi your server and client(s) are always separated, but on a listen server one of the clients is also the server
So you might spot some issues, especially in C++ (i.e. rep notifies in C++ don't execute on the server, whereas they do in Blueprints)
that one is one of the easy ones to fall into
My current understanding of multiplayer (engine agnostic) is this: the client has code A, and the server (dedicated) has code B.
With listen-server, do I need to put both A and B into my client?
Unreal doesn't work like that
Server and client have the same code running (mostly)
Up to you to check if you're the server, or a client, or both in your logic
A single player Unreal game is basically a server with one player on it (you)
I think I'm followig
so with listen-server, the client hosting literally IS the server, in the same way Unreal is a singleplayer server. So it's up to me to have the logic in my game figure out if it's the server or a client, and treat it as such
yep yep
I basically have to make "all in one" blueprints that can handle it all
You have net modes in Unreal for that:
- NM_DedicatedServer
- NM_ListenServer
- NM_Client
That's an easy way to check if you're a server or client, as well as local & remote roles (authority checks)
In my head it'd make sense to split logic between graphs then right, to keep things tidy in my blueprints?
Server logic and client logic
that sorta thing
In the end you can just run some code on the server only etc
For example the GameMode class only exists on the server
Clients don't get it replicated to them, so it never runs any logic on clients
Yeah the key here for me is explicitly understanding that with listen-server, the hosting player is basically just playing on an omega interactive server
@solar stirrup do you know anything about this?
You'll need to use an online service like Steam or EOS
Both have a way to query sessions
Steam would mostly be the master server for dedis
or playfab?
I don't know if they have an API you can query for stuff like that but maybe
okay so I would have to integrate either eos or steam first
so the default subsystem works only for listen servers?
probably not during testing, you would have a known IP to connect to
OnlineSubsystemNull is just a test subsystem afaik
EOS is free, Steam is "free" if you use the Spacewar app 480
It's basically a development app to allow devs to test their online connectivity with Steam's API
eos is completely free?
Yep
To my knowledge, never had to pay anything to get it setup and running for my projects
thats hilarious
alright thats very helpful
Thought so! I might check master and PR the comment
I mean Steam expects you to have your own appid at a certain point if you're gonna use them for a game
@strong fable info about using spacewar
https://forums.unrealengine.com/t/how-can-i-test-direct-steam-invite-join-using-spacewar/380718
So yeah it's free during development but you'll want to pay the steam direct fee if you wanna release a game on Steam and then use that appid
I had to get one exceptionally early because I needed to test the install script used by EOS with my game, and couldn't do that with 480
yeah its for a uni project, so i guess its fine
I bought one just for my prototypes, I just re-use it if I make a new one heh
EOS isn't actually a bad stopgap if it's free
and sets you up for the epic store too, I guess
EOS is pretty good, albeit a little lacking notably in stuff like the Steam Workshop
What's good is the cross platform support though
you pay 100USD just once right or is it for each game
oh true, you can still sell on steam and just use EOS
On Steam you'd still connect to Steamworks but also EOS
and then you can just do crossplatform that way
aah
each game pretty sure
EOS doesn't require an account for just connecting using a Steam auth ticket
since they have their admin/overhead to do on your application, and also get filthy rich
It'll ask players to make an account for crossplatform however
Yeah per game
My latest proto only uses Steam though because it doesn't seem like the UGC stuff for EOS is there yet
And i'd rather just have the Steam workshop heh
But in testing, EOS is pretty damn good overall
Especially with plugins like RedpointEOS that handle Steam, Epic, console online services etc for you
whats your thoughts on how early to start integrating steam?
do you do it fairly early?
It's the first thing I do when I need multiplayer
It's super easy
If you just want Steam you'd use the OnlineSubsystemSteam and SteamSockets plugins
Assuming C++, if Blueprints you'll need to grab a marketplace plugin that exposes those to them heh
and for hosting dedicated servers, can you do it on steam or you need some other service like playfab or aws?
steam can't host afaik
If you mean renting servers, you'll need another system on top
Steam only gives you a master server for a server browser
yaya
I see
so i would need to host my servers on some other service and then use steam to browse those servers
im really new to multiplayer programming, hence these questions
Yep
It's why I mostly use P2P or want to go with community hosted servers for my prototypes heh
yeah p2p is fairly easy in unreal, but my uni is offering the highest marks for master servers
smh
do they expect you to shell out and pay for hosting?
seems like a weird way to grade, are you sure they dont just mean dedicated server in general
You can do a "server" browser and have it list publicly advertised P2P sessions
EOS would suit your requirements in that case
yeah at the end of the day it's all fairly similar stuff
anyway thanks for your help @solar stirrup that stupid little piece of info was all I needed for everything to start making sense
o7
idk, they prefer using unity and photon, and photon has free services so
our professor doesnt have much knowledge of ue
I wonder if you could just get a digitalocean droplet on the super cheap
and host it there
not like you're gonna have a 100 player battle royale running on it
but yeah id just host a dedi server at home on my pc and leave it running LOL

In theory, if my FFastArraySerializerItem has uint8 uint16 uint32 float properties, if I never actually modify them, they should incur no cost? They wouldn't do an initial replication of the 0 value? Just thinking of a simple way to have float compression that they can select via BP without having to make 4 different versions of my structs just for the different data type
Hmm, how come my Game State is not returning valid in my widget's event construct?
I'm not being backed by this promise ๐
With all that being said, this leads us to our exceptional guarantee:
GameState is guaranteed to be valid when any Actor on client calls BeginPlay.```
I think it might be because I'm creating the widget prior to begin play
I create HUD widgets in AHUD::BeginPlay for a reason
@thin stratus Hope you don't mind me @'ing you, I figure there's a very limited people who might know with any certainty
yea.
it was an anomalous behavior because the widget was being created in an on rep, which apparently can be faster than the game state's initialization
Yus OnRep can call before the Actor has BegunPlay, which is really shitty
Cause there are things in UE that fail silently
I don't know either. But afaik they use DeltaSerialization
Which by the name of it should mean that not changing the other values should be fine?
That's what I figure too
And I suppose I can always just run the debugger and see if it ever triggers for unused values
Does anyone know of a way to make the demo net driver for replays ignore a particular actor and not record it's network data? Trying to make it ignore a voip related actor as it chokes on the data and i dont want that stuff recorded to begin with.
i have a question,
if i were to make anything replicated run on a looping timer that lets say runs fast or anything run on tick, or lets say even a minigun shooting that is allowed to shoot really fast and has a lot of bullets- how are the packets handled? are we sending those many packets out there at the same time? what if theres more players with minigun now, is there a method to optimize this idea of sending so many packets or messages" of information or does the engine does this by itself?
Anyone ever get this error before "Assertion failed: !bPostTickComponentUpdate". Saw some forems on it but not answers.
Happens on client side during a RPC event. Game closes after it receives it.
Havenโt seen that before but UE-ByeBye Game seems appropriate
if I am taming a creature would I be better of referencing the BP player or bp player controller?
I think dont reference the player controller if you dont need to, so BP player
ahh yes cheers.
does the (NPP) Network Prediction Plugin work in blueprints?
https://docs.unrealengine.com/5.1/en-US/API/Plugins/NetworkPrediction/
these are the only docs i could find online, and its just a bunch of cpp classes
I have 2 cameras on my player to switch between FPS and TPS view, so I'm supposed to handle all of this on the client however, I need the active camera to start a Raycast when I left click to attack, so should I repNotify my variable named "currentCamera" that contains the current active camera ?
Also should I also handle the camera switching (beween FPS and TPS view) on the server too as if I set my variable to repNotify it has to be set on the server and also to avoid cheating (even that I don't see how can the client cheat with this).
@thin stratus is there a way to avoid the byte cost of replication on a UActorComponent, I understand they send an additional uint8 to identify which component on the actor is replicating. For my plugin I can't avoid the use of components, but I'm wondering if there's a workaround. I will shamelessly add in the readme to just duplicate all of the code into your actor instead if there isn't though ๐
The only way is to do exactly that, move everything to the owning Actor.
CMC does this.
For example.
They have proxy RPCs on the Character class to avoid the overhead created by the component.
Yeah, that's actually how I learned about it ๐
I was hoping there might be some workaround to avoid it, but it's fine if there isn't
If there was wouldnt you think CMC would use that instead?
I'll provide components and for anyone who really wants the best possible optimization they can manually move the code to their actor
Hmm not necessarily, if there was it could have other downsides, just figured it was worth at least asking
I didn't think there was, but there have been times I missed something like that
Fair enough.
Thanks for confirming ๐
Any idea why this inventory component on this container is empty when a client opens it after the server puts an item in it?
(I have used print string to check this is the case as well as the debugger)
Are you attempting to replicate UObjects you created dynamically?
Yes, they are a class deriving from the UObject class that is set to replicate
I know default UObjects dont replicate
UObject does not support replication by default
Well then you should probably verify that you have setup replication for them correctly
Because it absolutely looks like thats the issue
Could you take a look at these if you get time? (btw there is a bunch of commented out code in these files, those were older attempts at me getting it to replicate to which I failed at)
this is the actor class that is assosciated with the uobject class
@glad cloak Are you using UE5++?
Yes
Follow this
You are using an old method
This post outlines a new method for doing subobject replication
Oh ok, the old method is deprecated?
I dont think so, but the new method I believe is much easier.
See i thought the same, and then struggled to implement it so i tried the old method. Il give it another shot ig, do you know of any good examples of it actually being used in replicating a UObject derived class?
Literally that topic
It shows directly how to do it
Should look into the documentation as well.
Also, if the old method is technically still working, why wouldn't it just work in my case?
I dont have time to read your code, sorry.
All good, il work through the article ty.
Hey everyone! Really basic question I think, how do I pass variables from the game mode through the game state in a way that the clients will get them as well? I am trying to pass a seed into a world generator. Gamemode passes in the seed, Gamestate then calls a multicast to spawn the generator. On the server it has the seed, but on the client it is always 1. I'm sure it's something simple, but what am I doing wrong?
@bronze glade Why are you just not marking the WorldGenerator Actor as Replicated and set the Seed also as Replicated?
There is no need for these RPCs
WorldGenerator is replicated. I think I made the seed variable replicated let me look
Could I just call it straight in the game mode if that's the case or do I still need to do it through game state?
Then you do not need to call a Multicast to spawn a different version of the generator on all Clients
Just spawn the Generator Actor from the GameMode and call it a day.
If its replicated, it will be created on the Clients
With the correct Seed
@bronze glade You should go read through the Network Compendium linked in the Pinned Messages
Its a very thorough document that sheds light on all things Network and Replication related.
Actor and property Replication are important concepts that you should get a full grasp on.
Ha, I had them all checked as replicated except I missed the seed lol. Thank you, I will definitely read the compendium!
so i call from my widget to my gamestate from host and it works, then when i try to call the same thing on the client it doesnt fire SVR populate names? why?
@wintry crane The GameState cannot call and RPC to the Server from a Client
It is not owned by a NetOwningConnection
Only a PlayerController or an Actor that is Owned by a PlayerController can call on RPC to the Server
Actors that are owned by a PlayerController are the Pawn its possessing or the PlayerState
ohhh
so only those
ahgh i am pretty sure i read that somewher
e
information is just flying out of my head sometimes
I think ive told you this before
i think at the time i thought that things that pc owns that would include created or spawned by the player
didnt know possessed pawn and player state are the things conidered to be own by pc
mb mb
They arent considered, they are. The PlayerController is their literal Owner.
Owner is a property of all Actors
anyone know what happens if I send an RPC on an actor that is not yet net relevant?
If unreliable it will probably not reach its destination
Got a more editor QOL question. Is there any way to have the Outliner->ChooseWorld option automatically select the Server world? Would love to save that 3 seconds of clicking every time I am checking things haha.
The wallrunning bool inside the ABP itself is not replicated, but it is being set each tick, based on a variable in the pawn, that IS replicated.
I checked with print, and the Pawn variable is replicating correctly to everyone.
But the character tilts only on it's own client's screen, the rest can't see the tilt.
Have you considered the fact that the data that drives the tilt is not replicated
Is there way to take my client bandwidth usage realtime? I would want to set UI text based on that so I can easily see it when I am test playing on server.
You can get the info you need from UNetConnection
InBytesPerSecond, OutBytesPerSecond etc.
Thank you!
Is it a good practice to have authority checks on non RPC functions that are planned to be used from authority context?
So I'm working on a multiplayer game with multiple streaming levels, each with it's own lighting. I'm trying to find a way that directional lights do not overlap, and only affect each light's specific level. Is there any way to set bounds for directional lights? Another approach I've tried, with limited success, is by setting visibility on individual directional lights from each character at the client level. I'm sure this isn't the first game with multiplayer using streaming levels, but after days of searching i've yet to find any solutions.
would player XP for skills be something best stored in the player state or on the character itself? i could also make a skill component and put that on the character
Hey, how games like candy crush handle sessions ?
they create a new session for every player, but in unreal engine do i have to create a new server for every player ?
Is it normal for only the server to get the clients control rotation replicated to them?
Does this mean only the server? DOREPLIFETIME_CONDITION(APlayerController, TargetViewRotation, COND_OwnerOnly);
OwnerOnly in this context is the server right? or is it local player?
Yeah which in the case of APlayerController is the local player right? What use is the local player getting their own replicated rotation back to them?
All other clients have the rotation for other clients as a static value, only the server is getting the replicated rotation, do you know if this is normal by any chance?
I would assume not because then client side VFX stuff would be useless since its not able to reflect the correct rotation for client A of what client B is looking at
I did an empty project to prove my hypothesis and it also had only the server with all the clients control rotation values
yeah thats weird.. it makes no sense TargetViewRotation is COND_OwnerOnly
youd think it would be COND_SkipOwner
well actually other clients only see their own playercontroller so that wouldnt do anything either
personally i just convert the control rotation Pitch value to a uint8 and replicate that and have the clients smooth it out
The comment above it explains why it's replicated
The idea is when you're looking through a pawn that isn't yours
oh for spectator reasons?
presumably yeah
ah makes sense
Or perhaps vehicles or something
Must be ancient, since the comment says "new condition system"
Might be legacy crap
yeah i am familiar with quantizing rotations an bitshifting stuff to get it back out but its throwing me off that its not done by default?
I guess i am manually going to need to replicate it and create some GetReplicatedRotation function that just creates a FRotator from it instead of trusting camera rotation stuff
yeah it might be one of those things epic thought was better to leave up to the dev to decide if they want to replicate it or not, since not all games would need to have to know other clients control rotation
The APawn::RemoteViewPitch is so you can reproduce other clients' aim, which is pretty common for any character based game really.
But APlayerController::TargetViewRotation is just so you know the view rotation of the object that's your current viewtarget, since it might not be your pawn
E.g, might be your vehicle, or another players' pawn etc.
Turret etc.
Hey, is there any way i can do:
ForceNetUpdate();
AfterUpdate.Bind(DoSomething());
My current code is something like:
AItem* ItemAdded;
// Add item on server
if (Inventory->Server_TryAddItem(ItemActorClass, ItemAdded))
{
if (ItemAdded)
{
// Update widget on client
Inventory->Client_AddItemWidget(ItemAdded);
return true;
}
}
return false;
I use it to update my inventory widget. I just have a lot of problem with my inventory system, because when i do any action, like adding an item, it will add on the server, then call an RPC back to the client to update widget. However when the RPC arrive, the variables used to update the widget is not replicated yet.
Thats perfect and what I was after, thank you
based on my experience having then as ReplicatedUsing (aka. repnotify) and doing the ui shenanigans in the notify function should always guarantee that the data is in sync with the server on the client.
Any fixes for rubberbanding?
I am using that, but RepNotify doesn't give as much control as a RPC
I have a predicted property in my cmc called Blah, and Blah gets mutated using input, through the saved moves and so on. How can I mutate Blah authoratively given a server flag? So far I've made an authorative setter and passed this flag through ServerFillResponseData and its analogous Serialize. But I'm finding some desyncs on Blah. I've assumed they are normal, as I seem to be doing everything through the ClientHandleMoveResponse function. Besides the flag I'm thinking that i should also set Blah when my flag is set in ServerFillResponseData.
You can't really. The only way to do it properly is to use rep notifies.
Let me try to use OnRep_Owner(), since it gonna update the whole thing, instead of put rep notify on every single item variable.
No idea what you're doing, but if every item stores it's own hotkey etc, how are you going to avoid conflicts?
Sensible thing to do would be to just have the UI listen for changes to the inventory and update itself accordingly
How do i make the UI listen to the C++ items? I store widget pointer in each item and that worked for me
Put an event on whatever stores the inventory, broadcast that event when inventory updates
Have the UI bind to it
But in order to bind that event, the inventory still need to get the widget
it is very cursed indeed
Make your widget bind to your inventory's delegates on construction
and unbind on destruction
But i don't get it. The structure design is still the same. When i changed something, like a quantity of an item, the source of the change still come from C++. Then you can broadcast a delegate and the widget would change.
So it's like Item -> Widget.
Instead of doing that, now i am storing a direct widget pointer. When i change something, i just call straight on the widget.
It is still Item -> Widget. The only difference is the representation.
The only way the structure could change to Widget -> Item is some kind of tick behaviour, when the item never have to tell the widget when and what to change.
Tell me if i am wrong lol
This is more of a code design thing, but generally speaking it's preferred to have your UI code separated from your game code, such that it sits "on top" of the game code. Otherwise, your gamecode needs to be aware of the implementation details of the UI
UI is explicitly designed to represent something , so it's more appropriate to have it know gamecode details than gamecode know UI code details
Also, UI is usually complex in it's own right - it becomes a bigger problem if say, somebody opens the pause menu and your widget gets destroyed - then what?
Gamecode can push events without caring about who is listening for them
yeah that make sense
In practice it is quite difficult to achieve complete separation, but it's a decent thing to work towards
I just hate c++ delegate in general. The syntax burn my eyes
It doesn't have to be an event, the UI could tick the entire state each frame if it wanted - just not very performant to do that I expect
When my inventory changes I broadcast an event with a changelist, so it only updates relevant elements
A changelist? Like a log? That's pretty cool
How you do that?
That has to be my sanest way out of this
Like a FInventoryChange
I have a small inventory, like 4-6 items max. I just broadcast that something has changed and then rebuild the inventory in the UI. lol
Not that easy to explain, but the gist is store the inventory state before making a change, then make it, then broadcast the change when the operation completes.
My items are identified with ID's and have a scoping system for it so it's relatively cheap/easy to do.
Was super duper easy and fast to implement and won't hit any perf issues for my scenario
The refresh approach, saw this my first attemp of making an inventory but i was afraid of performance in multiplayer so i skipped
now i am too deep into this stuff, can't back out lol
I just use the fast array serializer for my inventory
I get add/change/remove events and just fire delegates
easy to bind for UI
If you're a beginner at this, get it working and then optimize if needed
You'll learn along the way
but i was afraid of performance in multiplayer
Did you benchmark? If not - why not?
Don't guess. Ever.
i dont know what is serialization, is it for pure save game or can be use to improve multiplayer/inventory too?
Serialization is basically just archive right?
WinRAR kind of thing
Serialization in Unreal can be for save games but also for networking
Amongst other things
Google the fast array serializer for Unreal if you wanna see what it does
yeah we dont even have a single document page for anything serialize related
Based on my experience, even if it would cause a full rewrite of the feature, you will save time by rebuilding it rather than sticking to a design that bottlenecks your progress. Of course in production (especially if the game is already out and customers are expecting frequent updates) we rarely have the benefit of doing this.
For a simple MMO where the only replicated stuff is character location/movement and occasionally triggering animations (like when a player starts dancing or does a high-five emote), do you think UE's multiplayer is good enough for 200+ players in one room/world or would you recommend using something more basic like Websockets?
You're not getting over 100 players in Unreal
At least with a vanilla engine
100 players is already pretty tough to achieve
lets say that my game is built for a listen server do I need to change anything for it to work as a dedicated server? (aside from being built from source)
As long as you handled the scenarios that are applicable to dedicated servers, should be fine.
do dedicated servers support blueprints?
Couple of places where poorly written could cause you issues (i.e expecting DS to have a valid player controller, trying to create UI, etc), but as long as you separated stuff properly it should work as you'd expect.
And yeah you can do DS in blueprints, multiplayer code is generally the same as for listen servers.
Performance is ofc a different question, but that largely depends on what youre doing and your project's scale.
lets say that we have a chest that is written entirely in BP, it has a replicated variable that indicate if its opened\closed
lets have another class of chest written in C++ does the same thing and we will inherit a blueprint from it for the visual stuff
would the DS build have both BP versions of the chests or just the first one? (the second one will use the base class of the chest)
as in it will omit the BP for the second one because it doesnt contain any replication code
no all referenced assets would be cooked and included in your build as you'd expect (unless you change it). Think of DS as your normal listen server host just without the extra fluff that comes with rendering graphics. DS builds should generally exclude sounds, textures and a couple of minor things I'm probably forgetting.
How does a delegate work over the network? Like it can just send data everywhere?
Doesn't make any sense
Say i have a delegate on my inventory, then i bind an event in the server to it, then i broadcast the delegate from the client, how would that turned out?
Doesn't seem like a delegate is replicated either
What would be the best way to carry the character class to spawn for game map with seamless server travel from a menu map?
The way I'm doing it is storing their selected character in their player state, I have a separate player state for my pre lobby from my actual game map so i use CopyProperties to save the selected character into my new player state and then spawn them in from the game mode
Hey, I dont know if this is the right topic for this question.
Im trying to make a Local Multiplayer game, where a new player can be detected in the menu, if they press a botton on a new gamepad. How can I archief this?
Hello, I have an issue that only got reported yesterday, on a project I'm releasing at the end of the month and hoped anyone could give me some go to checks
Over long distance (UK to US) character movement is very choppy / corrective and unplayable
I'm just using regular wasd > add movement input on a replicated player character bp
show code
Will do once I'm home
Use the built in network latency emulation mode in PIE, it will show most issues up. Its actually good practice to run with it enabled as standard during dev.
Hey thanks for the recommendation, I use this for debugging throughout the project and always noticed the jitter, when I ramp the packet loss percentage up, ofc it gets much worse
I do have it enabled by default on 'bad'
I.e. I'm able to reproduce the issue
I'm currently trying to diagnose why it's jittery, and identify a solution
Wondered if there were any 'gotchas'
Depends on your code
Maybe there are some command line debugging options for drawing correction
is there something that clients can bind to for when the gamestate is replicated? I suppose I could do some notify on state change/begin play on the game instance and bind to that for remotes but didnt know if there was a more proper way
Like any actor: BeginPlay()
You should handle it in your custom game state class
The gamestate isnt guaranteed to be replicated to all clients on beginplay though
AGameStateBase::BeginPlay() will call on clients when it is replicated for them
well yes, but my question was accessing the GS from other classes. Didnt know if there was a built in spot to do that besides handling a delegate broadcast manually
GameState should be available at BeginPlay on Clients
i thought that wasnt 100% reliable. Maybe im misremembering a conversation i had with someone prior
It should be reliable.
void AGameStateBase::OnRep_ReplicatedHasBegunPlay()
{
if (bReplicatedHasBegunPlay && GetLocalRole() != ROLE_Authority)
{
GetWorldSettings()->NotifyBeginPlay();
GetWorldSettings()->NotifyMatchStarted();
}
}
void AGameStateBase::HandleBeginPlay()
{
bReplicatedHasBegunPlay = true;
GetWorldSettings()->NotifyBeginPlay();
GetWorldSettings()->NotifyMatchStarted();
}
The OnRep handles Clients, the function at the bottom handles the server.
ah, yeah. thank you. I apologize. definitely misremembered something.
also I eventually found a fix to that voice talker bug. Persisting the actor in seamless travel didnt work because the underlying audio component that the synth talker (what plays the voice packets) was transient. So unless you heavlily modified the default implementation of a synth component to supply your own audio component to play all of the packets through thats owned by the persisent actor, it would crash each time. The fix was just to pause all incoming packet processing (the same as muting a player, but global) and unregister all talkers and clear the voip packet buffer. After that, no issues.
Seems like an oversight on Epics part really.
In that they didnt consider Seamless Travel transitions
Still unsure why epic marked it as "wont fix" unless they just saw what they would have to untangle with the synth component and gave up. Considering VOIP talker is basically legacy
That maybe why, if its obsolete then they wont fix something they arent going to keep around or update in the future
I could use some advice on a data storage method.
I am thinking of creating a server object - this object will be responsible for tracking all of the spawned actors during a play session, and then saving the actor's state (location, GUID, & reference). When the game server starts, it will load all actors (and re-associate references based on GUID).
For this data object, is it okay to store actors as an array? If so, I expect several hundreds/thousands of array elements. Is this okay, is there a better way?
example: Player builds a house, I want that house to persist through a server reboot.
- At the time of spawn, the house is added to this custom object.
- At the time of server reboot, the object saves its actors to a save game.
- At the time of server start, the object loads from save state and respawns all actors that it knows about
Can I just write these actors refs into an array on the custom object?
oh really well your a smart guy right ? ? you look like a smart guy so what's that then ?
can some one talk to me about the login ? and its it needed to control a rpg mmmo BP only game xD
@torpid lantern You wont be able to "save" an entire Actor.
You need to instead save out the data on that Actor you want to keep.
When you go to load it, you need to recreate the Actor with that data.
It is tedious.
I get that part. My question was more around managing a large list of actors at the server-level. What's the best method to track that data and save/load in bulk?
You might want to break it up into different lists, but Array can store lots of elements
Its not an issue
Unless you want to replicate that list
If it has hundreds of thousands of elements
Replicating that as it is would not work
If you are using C++ you can serialize all of the properties of an Actor into a byte array and store that instead.
That makes it much easier to rebuild it on load.
yeah ok so ,,, then if the exe can still be triggers if not use a launcher . that fix can be done with a method i use but i need first understand something about players acc and in open world if player save there data on there side then i not think game needs login . but i am all ears
and can it be possible to fuse external php registration to open on cmd with unreal engine after player register on the form ?
For local multiplayer, how do you guys get around the 5.3.2 bug for keyboard player 1, controller player 2 issue?
how can i run this exclusively on the local player pawn, and not on every pawn?
Hey guys, what does last value mean? It mean the current value on the server or the value before that?
So confusing with Unreal doc
LastHealthValue is what HealthValue was BEFORE the new value came down the pipe
"Hey your Health changed, here's what it was before it changed"
so i change my health from 0->100 on the server, the last would be 0? How do i get the 100 then?
but how do i get the current, what is the syntax
because the document only show the last value
i just remove Last from the variable name?
Current is just HealthValue
it'll be what the actual replicated variable is
oh,
ty
but the "HealthValue" doesnt even need to match variable name though, as in the doc it is "HealthValue1"
such a weird design
link the doc right quick
how can i reference characters for a passenger vehicle. I need to play animations for them but the anims only take one reference so i need to reference the right one.
The param in the OnRep function is just the previous value of w/e was replicated. You can name it w/e you want. The reason the example has HealthValue1 as the variable name is because they're showing multiple ways of using the OnRep stuff, but with the same concept of "health"
Vehicle presumably has an array or multiple character ref variables within it.
ThingHappened -> for each SeatedCharacter -> play anim
I would just have an event on your Character though, Event HitBumpWhileSeated or whatever
So the param can only 0 as in "Health changed from 0->100 in the server". There is no way for me to get 100, correct?
The 100 will be HealthValue1 or w/e you're onrepping
I am trying to reuse OnRep for multiple variable
In your code it would be HealthValue, because I don't know why you'd have one character with 3 different health values.
Don't
so should i make a character array for each occupied seat array? smth like that
0->100:
The param value will be 0. The current value will be 100.
Don't try to reuse OnRep functions
KISS
What do you already have? If you already have an array of seats and they have a ref to their character then you can just use the seats
However you do it, you tell all the characters "hey, something happened"
Which variables
some set of variables?
hello, how can i control axis values over the network?
what i mean is, how do i do this without just having the Set Throttle event be a RoS?
cause rn it sometimes just seems to lose input and it breaks, not sure why
im also not sure how performant it would be to constantly send RoS from every client like that
you don't
run on server is the correct approach, assuming Throttle isn't already handled for you inside VehicleComponent, whatever that is
The only way to tell stuff to the server is with a Run on Server event
i see
i just have an array of seats. the seats don't have a character ref yet
Either give the seats a char ref or have a parallel array of characters that corrospond to the seats
can someone please check my replication for my combo attack system
thing doesn't work fine there and im not sure if i did it right or i missed something
good god my dude
any particular reason you're not using the replicated play montage nodes?
what is that
I think Character has some stuff for that
im searching everywhere and applying what i learn and never saw that
Anyway, there's no way anyone can debug this just from looking at it, you got tons of stuff going on
yep i know, is there a way or something i can do to give a better info
like i can screen share if you want to
are these bots ?
?
seriously wtf is goin on here 0% health yayaya daa bee beep and ref to nothing was this ?
i went for tea and come back there is a random wild chat ?
what are you on about lmao
that seem E = mc is not a square but fry egss was more intriguing to talk about here
first of all its E = mcยฒ
second of all what does that have to do with anything
why are you so mad
@modest coral Please stay ontopic and remain constructive.
ill do the same
that was my point it is E = mcยฒ
oh great his here and got what he wanted ok dude
Hey, is there any way to 100% create an inventory widget? First i create the inventory struct in the server and let it replicated down. To create the widget i need a pointer to the actual struct, so i can't just do a client RPC, because the RPC will run before the pointer is replicated. I can try to create the widget in the inventory struct BeginPlay, but there would be no PlayerController there.
It has to be something to do with OnRep, but idk which OnRep to call. Tried on Rep on the inventory pointer but that didn't work.
void UInventoryManager::TryCreateInventory()
{
if (!IsValid(InventoryStorage))
{
InventoryStorage = GetWorld()->SpawnActor<AQyStorage>();
InventoryStorage->SetOwner(GetQyCharacter());
}
}
void AQyStorage::BeginPlay()
{
Super::BeginPlay();
if (TryGetQyPlayerController()->IsLocalController())
{
// Create the widget
TryGetQyCharacter()->GetInventoryManager()->OnAddStorageDelegate.Broadcast(this);
}
}
yes there is , if you search on you tube you can find it under replicated RPC
ok so anyone can tell me about login ?
or is this question to easy for the intellectual minds here ?
you ok bro?
well maybe you didn't see it from all the stuff ....got over it
i lost my mood see ya
well you were gone its only natural people asked their stuff instead of pausing the entire chat for your tea time
was about sometging about exe and player can execute still
if use launcher but nah you guys can continue i be fine
i snot first ime and then get mute for a week ?
user that help me once got ban ?
yeah ok see ya
<@&213101288538374145>
lol
?
this guy is trolling
@modest coral I asked you earlier to stay ontopic and be constructive
This is your last warning
I'm guessing language difference tbh, but yeah
Just ask your question and we'll see if we can help
okay so i added a character array for the seats. now how would i play the same enter & exit events but for these different characters
or how do i select the right character to play the anim on
what info do you have?
do you have which seat or which character?
choose the seat -> find in array -> set character to be that index in character array, now it's lined up
Why do you have an array of bools? You can just have an array of whatever a seat is and a corrosponding array of characters
a pointer can be null, that can encode "Who's sitting here? Nobody"
Seats are just tags. Better to use bools
Probably better to just have an array of player character references
So you know if a seat is occupied and who occupies it in one array
However you do it just have some data structure that you can query for WHO is sitting in a seat
Seems like they have multiple arrays for that purpose
It could be as simple as an array of fixed size with character references, or can be 2 arrays in parallel, or a map, or an array of structs, or whatever
that's why I'd use an array of player character refs instead for both purposes, and tbh, personally I'd have a struct with all the data needed heh
This array stuff is not important. The result is the same. i just need to know how to play the animations for the right characters
If you know the seat, you know the character. If you know the character, you know the seat.
If you know the seat, you presumably know where the seat is on the vehicle
If you know a location, you can figure out which seat is closest
etc etc
The seat is irrelevant to the animation. i need to get the right character from the array when the event fires
Ignoring how the setup is iffy at best, you can just pass the character reference or seat index as a parameter in MC_EnterVehicle
Also mixing RPC and replicated properties is bad: you have no guarantee one will execute before the other
You're basically rolling a dice to determine if it'll work or not
My first draft of this would have a socket or scene component per seat. That represents the WHERE for each seat. Then slam them all into an array on begin play, and make another array of character refs the same size. Now you have 2 arrays, one representing the seats, and one representing the sitters.
Character.TryEnterVehicle would query the vehicle for the appropriate seat, and call EnterVehicle with parameter representing the seat to enter for.
Would be easier to have the seat & sitters be in a single struct
All in one place, guaranteed* to have all the data you need to play cosmetics in the rep notify
*only if the characters have replicated to you before the vehicle did
On a successful enter, you set Sitters[index] = CharacterThatJustSat
yeah i mean this whole thing is a disorganized mess lol
it should all be driven by repnotify IMO, but you'll have to do some sanity checks so driving into an area and making a new vehicle relevent doesn't show a bunch of characters getting in while it's driving lol
how is it disorganized if i have literally the same thing you just wrote
You have two arrays
It's bad design
@twin juniper moving here since it's multiplayer: replication order is not guaranteed, so it can always change
Is this to enter or to try to enter / query for a seat?
You have to write networked logic that is resilient against different orders of execution
ia coroutine?
hell no don't bring coroutines in to this now lol
It's one way of doing it, in a coroutine you'd be able to wait for all the actors you need to be replicated, but it's complicated
i just cant find a way to do network logic that make sense
and if you haven't gotten the basics of multiplayer in Unreal, maybe skip that for now
try enter
Your best buddies in multiplayer are BeginPlay() and rep notifies
is that code in the vehicle or character?
BeginPlay/EndPlay call when an actor spawns from replication or gets destroyed from replication, rep notifies for property changes
Yes, honestly I'd just delete every multicast from your project and force yourself to do things with repnotify until you know when it's appropriate to multicast
idk who is talking to who bruh
im using reps too
RPCs should not be used for stateful stuff, so in your case you'd only wanna use replicated properties and rep notifies
Not both: that's a recipe for disaster
i just need to get the stuff to work first and worry about other shit later
I'd set up this system to work without the animation, just using onreps to go from walking to sitting in a seat. Do that, then later you can add the transitionary animations however you want. You can do that with onreps too, or maybe use a multicast if it ends up being appropriate.
Well believe us, your stuff won't work like this
The STATE of being in a seat shoudl be an onrep either way
And if it does, add a sprinkle of latency and it'll break
the seat stuff already worked with teleporting. now i just need to add the anim part
In your rep notify you can determine who just entered or left the seat and play animations
Would literally make it easy for you to add anything you want then
animations, sounds, UI stuff w/e
multicast or repnotify?
Get it to work with no multicasts
server
uh
the request to sit should be a run on server event yes
but the thing that drives what people see should be a repnotify
i can switch to rep in 2 seconds. its not important
ok so to start, play the anim in the onrep
IDK if you have access to old values in BP onreps so it'll be breakable but it should be visual only, not anything game breaking
Basically, assuming you have access to old values. You want to play an animation when the inhabitant of a seat changes. If it goes from nobody to somebody, that somebody plays the getting in animation. If it goes from somebody to nobody, that somebody plays the getting out animation.
or the other way around. If Character.MySeat goes from Nothing to Something, then play the sit in that seat animation. And the opposite when it goes from Something to Nothing.
I don't think Blueprints allow you to access old values in rep notifies, however you can just keep a local copy of the array
ยฏ_(ใ)_/ยฏ
Are you guys happy now? i made them on rep wohooo.
Hey if you wanna make a game that runs on flimsy netcode you're free to, we're just trying to help ya get better at multiplayer
:p
i cant pass the reference to the event with onrep.
You have to determine what happened
Here's a quick rundown of what you need to do:
- In the rep notify, keep a copy of the previous value of the array (local copy, not replicated)
- Compare the previous array to the current array, you'll need to loop to see which seats got emptied and which seats got occupied
- You can then do whatever you want for seats that got occupied and for seats that got left
How do i do the first one. I'm not that good with arrays
I know some mutliplayer basic but i have a problem that's can't be solve by those anymore. Basically i just spawn an actor on the server and have a replicated pointer somewhere. And i want to use that pointer to spawn a widget to the player. The player is in client side.
So in order for this to work, i need both the actor pointer + the player controller exsist at the same time client side.
- If i call an RPC from the server to spawn the widget, it would fire too fast and the actor pointer wouldnโt be there.
- If i use BeginPlay() of the actor in client side, the PlayerController is not there.
- If i use BeginPlay() of the PlayerController in the client side, the actor pointer is not there.
So either i am wrong or i need something else like coroutine to continue
- RPC is a bad solution, replication order is not guaranteed
- Literally wait for both to BeginPlay
you mean do 2 if
This smells like bad design from your part but that's another problem
With your current situation, I'd just check if the actor is there in your PlayerController BeginPlay and if the PlayerController is there in your actor's BeginPlay
One of those BeginPlay calls will have both actors there (duh)
Order resilient
but that's so bad
You can fire a delegate when your PC begins play, a bit tidier
That's a problem with your design, but it's also inherently of Unreal's networking works
You have no guarantee for replication order
so with that case, is it better to have coroutine
Coroutines make this "cleaner" if you write it clean
You can have a coroutine wait for the PC to be there through a delegate you call when the PC begins play
Thanks to UE5Coro it's pretty easy to do
ok, thanks a lot
I'm not sure its because i have a bad design though. The need to initialize thing in BeginPlay is quite normal?
@twin juniper UE5Coro is just syntax sugar. It won't address your pivotal problem, and as per @solar stirrup has said, is more foundational and bond to your design.
Lyra has introduced a concept I appreciate and settled myself: Experience. More here ๐ https://github.com/EpicGames/UnrealEngine/tree/ue5-main/Samples/Games/Lyra/Source/LyraGame/GameModes
I think i should post my whole problem so you guys can help me decide whether it's a bad design or not
Before you do that
APlayerController exposes a method (C++ only) called AcknowledgePosession. What it does is pretty simple: whenever a player controller was given a pawn (via Possess), that function is called. The juice here is that it happens on client/local instances.
That said, it's an easy/cheap way to address this clutter you've been talking about.
i use OnRep_Pawn, they are not the same?
Sorry, I don't know. Been fond to AcknowledgePossession and it covered all my use cases.
The gist is: AcknowledgePossession would replace your BeginPlay for situations where you want to do something only when your PC has a Pawn. It's guaranteed your client has a pawn by the time the function is called.
Yeah doesn't matter anyway, since my problem not related to a pawn but a different actor
appreciate the help bro
Architecture>
- player is given abilities 'ga_crouch, ga_walk, ga_sprint' with corresponding enhanced input actions
- when the ability is activated on the server, authsetmovestate is called and rep'd down via OnRep_MoveState
- OnRep_MoveState will call update move speed, which uses the variables to determine a move speed for all connections
- Native Character start/end crouch also trigger a move speed update because crouched is a condition in the logic
Yeah you cant use replicated props and rep notifies to affect movement, the server will apply those before the clients and they will get corrections
No C++? You kinda need it to modify the CMC and route all this through it for proper prediction
@wintry dirge
Ok, c++ required, noted thanks
Yep it's a BP only project.
The gameplay ability can be set to predictive and apply the change locally also which may help
If you use the GAS it does have ways to handle movement in abilities
Which might be what you're looking for
o7
Yo guys anyone can help me out ? im trying to do chloth painting but for some reason the cloth looks for all the clients like this (bandana)
the top right window is what the client is seeing
is there any useful resources on using the VOIPTalker? besides setting it up for the player... for example, how can i modify send/receive volume of certain player for a client?
google comes up with nothing
seems under documented
I think that's because it's under developed
It's really not good iirc, it has most basic functionality and not recommended for anything serious
The network mode the game is currently running.
thank you
Neither CopyProperties() nor OverrideWith() seem to be called upon my level change with ServerTravel(). I've seen it should be a seamless travel for them to work and I'm travelling like GetWorld()->ServerTravel(GameLevelName). Is there any obvious mistake that I'm doing about these?
Ah after setting AGameMode::bUseSeamlessTravel to true, it seems like now using seamless travel. I was able to get the APlayerState::CopyProperties() being called on my lobby player state with the input being the game player state
What is correct way to spawn muzzle flash? I want to spawn it locally so it doesn't have any latency. Then I want to spawn it to other clients "non reliable". (in image that first event is called after input event)
Surely most of that information is already available to every client? No need to pass it via the RPC
I'd consider using an incrementing counter with COND_SkipOwner instead, and I would definitely determine the parameters independently client-side. Shouldn't be any need to send attachment information, or the emitter template etc.
Also, I'd drive all this from existing "firing" RPC's/logic if you have it
Thank you!
Is there any form of delegates that works across multiplayer, or has anyone tried implementing that? e.g. client sends out a message, server listens for it
i.e. going beyond strict reflection/RPC model
should be easy to implement
There isn't no
If I would like to have two separate tagged group of PlayerStarts, would I need to provide my own logic to pick a random start point for the team player belongs to?
ChoosePlayerStart gets one of non occupied PlayerStarts without checking tags and FindPlayerStart only seems to check the tag and not if the space is occupied or not. Is it up to us to combine these logics?
Yes
is this a good idea to store all !DeadPlayers info in the GameState?
!Dead? as in... alive?
yes
why not just call it that then
also the GS is typically for information you want to broadcast to all clients in the server
so if that's something you want to do then, do it I guess
if it's something for the server, then you can just store it in the gamemode
then GS is the perfect place for this
all players will know how many players are alive
well do they need to know how many, or the specific players are alive
because that's slightly different requirement wise
in the top right corner the numbers of total players alive
then just add the number to the gamestate? you don't need a TArray of playerstates to give you that
I have a ServerRPC on my Pawn, and am trying to call it from my PlayerController..
It does not appear the RPC is running on the server?
Pawn header
UFUNCTION(Server, Reliable)
void SrvMoveLocation(FVector2D Input);
UFUNCTION(NetMulticast, Reliable)
void CltMoveToLocation(FVector2D Input);
Pawn Source
void ATempoCharacterBase::SrvMoveLocation_Implementation(FVector2D Input) {
UE_LOG(LogTemp, Warning, TEXT("checkingAuth"));
if (!HasAuthority()) return;
UE_LOG(LogTemp, Warning, TEXT("AuthHas"));
if (!bCurrentlyMoving) {
CltMoveToLocation(Input);
}
}
void ATempoCharacterBase::CltMoveToLocation_Implementation(FVector2D Input) {
UE_LOG(LogTemp, Warning, TEXT("Movin"));
MoveUnit(Input);
}
CltMoveToLocation never gets called
weird to prefix a multicast with a contraction of "client", a bit of unnecessary code golf going on. however, is the pawn here one your player controller is actively possessing?
Yea admittedly its only because I said "srv" and then felt the need to make a 3 letter shortening of client. and really its a multicast so it feels even worse, apologies for the poor quality.
and it should be the one my playercontroller is possessing..
well you haven't shown the controller side of this yet
void ATempoPlayerController::OnMove(const FInputActionValue& InputActionValue) {
const FVector2D val = InputActionValue.Get<FVector2D>();
UE_LOG(LogTemp, Warning, TEXT("Startin"));
Cast<ATempoCharacter>(GetCharacter())->SrvMoveLocation_Implementation(val);
}
I'd hate to dump the entire controller and spam is there anything specific that would be to look out for?
oh .. Am I not supposed to use _Implementation when calling.. only defining?
Yep
Define normal, implement and override _Implementation, call normal
๐ฎโ๐จ its wild because the servermovelocation function i do it properly to call cltmovetolocation..
its been a long night. Thanks all ๐ญ
Is it normal that I can't see the widget I added from the LevelBlueprint of my transition level, while seamless travelling? If I open the TransitionMap as the target map, then I can see it
If so what are the supposed addition and removal places for loading screen widgets during seamless travel?
Looks like it's firing but actor never destroy in game
I cant remember the exact reason this happens, could even be a bug... but the way I worked around it is creating the loading screen widget in my pre lobby player controller but also saving a reference to it in my game instance so i can remove it again after server travel
Comparing the seats will ignore the first interaction when no previous character has yet been in the seats
Then don't compare if this is your first rep notify
If it's your first rep notify the vehicle just got relevant to you for clients and you don't need to play cosmetics, or you're the server and in that case you know you can play cosmetics for anyone that's now seated
Hmm I see, thanks
If you have a quick google you'll see some posts about the same issue where people cant use the transition map to display widgets just not sure if its by design or a bug lol im also funnely enough having an issue with my loading screen now since updating to 5.3.2 from 5.1.1 where it just displays the loading screen for a second and then it just removes itself without ever calling Remove from Parent somehow lol so you might have to play around with it to find a solution that works for your case
Is GetSessionIDStr the same as SessionName?
Im unable to join a session if so... and get UnknownError as the result, with the resolve connection string failing
so I guess not?
but then I cant actually get the session name from the search result, as far as Im aware
Hello! Iโm working on my first multiplayer project in Unreal Engine 5. However, Iโm facing a small issue. I want that all the players, when they enter a lobby, to be โteleportedโ simultaneously to the next scene. I managed to make this work in the editor, but when I create the executable, this specific part of โloading the next sceneโ doesnโt happen.
I have a video showing how it currently works in the editor: players search for a match, and if they donโt find one, they create one and join. After that, the game loads the next scene(the red one), taking both players to it.
In the executable, it only works up to the first partโplayers entering the same matchโbut it doesnโt proceed to load the next scene as it does in the editor.
Iโm using a Steam subsystem and their test server. Upon entering the scene, I have the Player Controller I created cast to the GameMode of that scene, sending its PC. The GameMode then adds this to an array, which is later used to check the number of players. If itโs complete, an event is triggered to travel to the desired scene on the server
Are you using ServerTravel?
yes๐ค
y multicast?
never done server travel but shouldn't the server calling it is enough
everyone will auto follow afaik
yeah something like that
nice, I'll test it!
if I'm reading your code correctly , you should just do this on PostLogin in game Mode
the event will get called everytime a new player join (On server)
On a mmorpg is a data only blueprint good for items? can unreal handle like 300k UObjects?
Okay, I'll look into how to do this in PostLogin, I haven't used it yet. Thx, Cold๐ค
sounds like you will need to stress test
You're gonna hit issues with 100/200 players as well
If pax dei is doing 150 i will do 200
No matter how
Even if i need to modify unreal source
And strip things from CMC that i don`t use
Using the CMC for an mmorpg is already a bad idea
No, it will work, i will make it work even if i need to edit but ty for the tips
You can't just one up people and think it'll just work, I'm already surprised by their claim of 150
But hey, hope you manage though
Sounds like you're pretty determined and that's cool hah
Yeah
My other mmorpg had 1200 players on a single map
I need to make it work with 200 lol
I`m already using Iris and push model
You can check the ue5-main branc-
Ah well then potentially yeah
Dunno how far Iris can be pushed but Epic seems to want it to support larger player counts
Good luck!
As for 300k UObjects the GC is probably gonna halt to a crawl with reachability analysis and the sort
It will quantize data a single time and send to all peers avoiding a lot of cpu overhead
This is how i did on old mmorpg
Might have to disable lots of it and modify the engine quite a lot
But the bottleneck is CMC at this point
Yeah, if it does not work i will USTRUCT then
Go for as little UObjects as you can I suppose yeah
There's also the new Mover plugin on latest git
It's Epic's new movement system aiming to replace the CMC
@dark parcel Just to keep a record, that worked. Thanks!!
Worth a look perhaps
It looks a bit more extensible/flexible but you need to pay somewhere for that?
by somewhere i mean cpu cycles
Im already not playing animations on server. it is only a capsule, i hope mover dont need animations on server also
I will switch to USTRUCT for individual items, easier for GC
Hey. I have a Fuel Canister which the players can interact with and detonate which works as intended across the server and both players see it was interacted with and that it explodes, however when I try to make it so that the player that interacted with the Fuel Canister has -2 subtracted from their Energy Gauge, it subtracts -2 from both Players. Ive been messing around with it for a while today, but thought id ask incase anybody knows. Happy i got other things to work across server but having objects set things on individual players I don't quite have down
well.. show what you're doing
Will do was just cleaning up something 1 sec
I've been trying to access the player in diff ways to set just their variables individually with no luck. The Rep Notify you see on screen is just to change the material on the server, that works correctly.
So right now those nodes remove -2 from BOTH players when they have 2 gauge or more each, I tried getting the player controllers etc to remove the -2 from jsut the player interacting
Instead of using GetPlayerController0, pass the player controller through that interface call that used the canister then subtract the points
getting a player character by index is almost always wrong. how does event interact get called if you're a client?
What engine version are you using mate?
Ahhhhh now that begins to make sense
Here it is, this is working properly as far as individual players interacting and detonating the fuel canister
well I guess you don't have single player or listen servers then
but yeah, you'll have to pass the interactor (character, player controller, whatever) to provide context
Running Play As Client for that so server launched in background. I'll have a crack at passing through the controller thanks guys
I knew it was to do with the controller just didnt know best way to access the info, im sick today so brain not exactly firing on all cylinders ๐
well if you support single player, pressing the key will do nothing there. if you support listen servers, the key will do nothing for the host player.
This was my fear when i followed the tutorial, i followed various approaches 1:1 and they didnt work, but this approach did work and i understood why, but the tutorial showed to switch to the Play As Client so thatit worked properly and that worried me as before that I ran the Net Mode as 2 player Listen server. I am due to test with a friend later so i see interacting wouldnt work properly now with my Hosted listen server approach if i understand that correctly :/
Its for a Co op 2 player game
From my understanding this approach im using to interact specifically works for say hosted Dedicated Servers that clients connect to then
Which won't be of use for now, as I just am hosting own listen server when create game
5.3.2
Thanks for your help though guys, appreciate it. I'll get to work fixing a new way to interact over listen server
do you understand the host <-> client interactions and calls required to communicate between them? It will help you develop better and faster for future issues
having an understanding of networking principles is crucial, more so for UE as it is server authoritative focussed
following a tutorial to do X and Y with no explanation is following blindly
and setting yourself up for failure, and a lot of pain in the near future
I do in parts, I just started the multiplayer project a few days ago, first time doing MP. For example I'm able to say have my player execute an ability and have it be sent to listen server and show for all clients and deduct their resource if executed from the player themself. That interact interface tutorial i followed was actually one of the first things i did so i'll have to go back with fresh eyes to do that
I only just returned back to UE after years away (been trying all major engines), and I know i shouldn't jump straight into multiplayer but im enjoying it ๐
100% I always like to understand what Im putting in and i get its super important how you setup the foundations for the co op game imd oing.
it is very fun to develop for sure, but can be head bashing at other times - as long as u understand server is the only place to execute the actual action, and clients simply "watch" the changes, ur at a good start
Absolutely i get that mate ๐
Been trying to think to send to server only absolutely what is necessary and thinking about what i may add in the future and what data that would actually need to read
It has felt like war at times, but satisfying when you see the thing happen on multiple players screens isnt it ๐
to answer the original question though, about the subtraction of energy points affecting multiple players, you can store that data anywhere. For my project, I store an arbitrary number (like health) in the character class - to me that makes sense. Character status goes in the character class. You should make the non-server clients send a request to the server to execute the action, and with that action you subtract the server's version of said players energy. And replicate that value back to the client. The convenient part is if you pass the client's character to the server, the server will know exactly which client's character to change.
and thats it
as far as I've developed, the client only needs sends information that the server will need to recognise what belongs to what to change
Ahh you might have the same issue as me then, it looks like they've made server travel remove all widgets just before it travels which they must of updated at some point after 5.1.1, but you also cant use the transition map to display the loading screen so no idea how to get it working atm
Also, when calling ServerTravel Map in editor, nothing should happen, but in my case the host and the clients they all are moved to the new map. Here is a video with just one player inside the editor calling ServerTravel and moving me to the new map: And here is a video where the host and the clients are moved:
Cheers will bare that in mind. Yeah its all about how you pass over the data to other parts of your game, certainly something I am going to focus on understanding and getting better at until i feel very confident with it. I always found how games communicate info with all various types and elements of your game to be the hardest part in game engines really.. Making abilities themselves or other things i found that alot easier
So i will focus on my weaknesses ๐
Hmm is it normal that if I spawn and possess a character in PostLogin, BeginPlay is called after Possess is completed. But if I do the same thing in HandleStartingNewPlayer_Implementation, BeginPlay runs between spawn and possess, which causes the IsLocallyControlled check in BeginPlay to return false, sinde the controller is null
I have a question, i have created a multiplayer mod and i have a save game rotation on that. It works fine But the server has performance issues while saving the game. is there a way to say the engine "do this stuff with low priority" or somthing to save performance while saving?
So PostLogin can work before BeginPlay for listen servers standalone game? Interesting
@jade ibex I'm curious how often you use the Reliable replication setting? By instinct I just switch it on
I assume it hogs more packets
Use reliable when it HAS to happen and is not time-sensitive. Use unreliable when it doesn't.
Spamming inputs on tick at the server -> unreliable
since by the time you notice a missed one it's way too late anyway
Some important input that has to not be dropped and isn't being spammed -> reliable
AimDirection -> unreliable
Readying up to start the game -> reliable
Brilliant thanks
๐ค
hey guys good evening
please a quick question
whats the diffrence between client build and the main game build am curios if there are the same or diff
Could be the same, could be different
depends on the game
If the game has no single player then you might want to not ship the serverside code. Stuff like Path of Exile or League of Legends would maybe do that.
please shine more light
I mean it's totally up to you
so if its strictly multiplayer shipping client alone is ok
Sure, if there's no single player or player hosted listen servers
If you have to ask then you won't be doing this sort of stuff.
ohhh so with dedicated server client side build is ok
in a nutshelll just build the dedicated server and the client and leave the main game exe file
since the server will be hosted online and dosent need to be a client on its own
and the client will just be clients and do what client do ...join matches
rights?
Pretty much
Dedicated Server -> serverside code
Client -> clientside code
Standalone or listen server (probably just do this) -> server and client code
in this context server is the main game build right ?
what is the difference between "is server" and "has authority"?
Even though I know the difference in definition, I can't explain it with a concrete example. Does anyone have an example to provide?
dont know i think they basically same thing i stand to be corrected
Clients have authority over actors they spawn locally
that aren't replicated from the server
is server would be false but they'd still have authority
HasAuthority pretty much means "which machine spawned this actor". Unless you go out of your way to change authority at least. But if you're doing that, you already know what HasAuthority means
which functions should be replicated to other clients?
i think ammo related stuff should not be replicated, since it only need by the owning client to know how much ammo she has

same here ๐
Thanks
Thank you very much.
So, in what exact situations we should use this? When do we need to perform authorization checks? If I need to show a widget only to the person who creates the session (so the server), I use 'is server', and if I want to apply an operation only on the person who performs it, I use 'is locally controlled'. So, could you provide an example of when I would need 'Has Authority'?
What class is bringing up the widget?
What I meant by showing a widget is when I want only the server to execute that action when a text or a button inside the widget is clicked, I use 'is server'.
Hi, i am still trying to learn coroutine to solve this. But today i stumble into something called Timer in Unreal. Would it work for this purpose? I am still reading about it.
Oh, was that a question or an example of "Has Authority" lol
Actor.BeginPlay -> Actor.TryDoThing
Playercontroller.BeginPlay -> Get Actor -> Actor.TryDoThing
TryDoThing -> if PlayerController exists -> do the thing
That'll work on one of the paths
What if they're not the server and are not locally controlled? You can just do a HasAuth check and be done with it.
A widget is local and not network aware anyways. Have the widget call into some event or function that gates by HasAuthority
The widget should only be spawned by some authority gated code anyway
What does IsServer return in standalone?
True
that doesn't work for me, since i have mutliple variable that need to be available too
i tried
Then just try do thing on tick until they're available idk
or use an onrep
how about a timer?
This is all it does. And standalone counts as a server.
thanks
thanks
Can anyone help me with something?
Full project with extras: https://www.patreon.com/PrimevalForest
If you want to help my development, wishlist: https://store.steampowered.com/app/1908530/Raise_Your_Tribe/
Discord: https://discord.gg/DcktP5mfXM
Please comment any suggestions to improve the tutorial series in the comments section. Additionally, feel free to ask any questions you...
Im following this tutorial
(ive been following the whole series)
and at the part when he makes it do damage to the other play I followed the totorial
and its not working
show code
we have no idea what your code looks like unless you show it
show what calls ApplyDamageServer
that's a pretty bad design though, why is ApplyDamage a run on server event, clients shouldn't be telling the server how much damage got applied
MB
So since it looks like they've made it so all widgets are removed when server travel is used.. and transition maps cant be used to do loading screens, how am i supposed to do a loading screen when using seamless travel?
I had it set up so the loading screen would be displayed just before server travel and then removed at a later point once the map had finished loading in but now i cant do that apparently after updating to 5.3.2
Is there a way to access where server travel is called in C++ and stop it from removing all widgets or something?
I don't understand how they expect us to make loading screen now.. or am i missing something?
This phrasing is ... weird. My understanding of how this works is that it's null when CALLED BY remote clients (and then only if you're not calling it on your OWN player state). The phrasing implies CALLED ON, but that obviously can't be the case 
Maybe by "remote clients" it means "other clients when you are a client" but that's a stretch
If the object the function is on represents a remote client it'll return null. If the object represents you then calling the function from a remote client will return null.
Both cases can be true.
What if the server calls it
Server has remote clients, that's why it's weird phrasing
The server has everyone's PC so surely it works
Unless "remote client" is some term of art and there's a separate technical term for "clients from the server's perspective"
the server knows about all players
Sure they probably could have said "or null on remote clients".
Yeah I'm just trying to make sure this isn't going to surprise me 
But you are looking to far into it, think about what is available to the server
Yea
I get paranoid ๐
Then read the code behind the function instead.
Hey guys, if delegate is not replicated, does that mean each actor in client and server have its own delegate?
A delegate is part of the class, calling a delegate is like calling a function. Inherently it is not replicated. That means in order for a delegate to broadcast on each machine, it must be called (like a function would) on each machine.
so in order to use a delegate i have to use RPC
What do you mean? If you need a delegate on another network context to be called, then sure, you need some mechanism to get it to be called in that context.
If an RPC is what does that for your use case then sure
Like i add the item on the server, but the delegate that have the widget binded to it is in the client
So the delegate in the server have nothing binded to it?
I guess RPC would do
If you want to think about them as separate then sure. I can see how you might see it that way.
Delegates have nothing to do with networking
Same way functions dont
Calling a Delegate on the Server does not automatically call it on Clients
Thats your responsibility
To call the Delegates where appropriate.
hey there, im trying to spawn a widget locally on every client that shows speed and other info
since BeginPlay runs on both client and server for every actor of this class, how can i know which one is the one i'm controlling and only spawn it once?
i tried IsLocallyControlled but that didnt seem to be it
i also tried doing it without a branch and it works but it seems to spawn the widget on the server instead?
OnPossessed is only called on the Server
See the little Icon above it to the right
Thats the "Authority Only" icon
Which means its only executed on the Server
So none of that will be called on clients
makes sense
Try using the HUD class
To manage Widgets
Also if this is a Pawn
You probably want to use the ReceivedRestart event
I think thats what its called
I forget
this one i think
That one
Essentially its a better version of BeginPlay for Pawns
Move your code to that and try again.
You will want to add back the IsLocallyControlled node to
yup, works!
for some reason, only the server is updating its speedometer though
in case i didnt specify it, the widget in question is a speedometer
Widgets should only really be reading and displaying data
So if it isnt displaying correctly
That would suggest your data isnt updating
Just a guess
But I cant debug it for you
Thats on you
mhm, thanks!
Hello, what is the best place for a client to be notified that the game state is replicated when it connects to the server?
BeginPlay of the GameState
But with a delegate?
Are you in Blueprint Only?
C++
I doubt there is a delegate for that
I know, i was saying to create one
Probably the WorldSettings
But that would need to be placed outsude
Game instance is not great
Because you could have different game states for your game
I said the WorldSettings
/**
* Called from GameStateBase, calls BeginPlay on all actors
*/
virtual void NotifyBeginPlay();
Specifically this function
Override this
I'd ask what needs to know when the gamestate has been replicated
because if the answer is an actor, it already has a callback for that
BeginPlay
^^
BeginPlay isn't called on anything until the gamestate has replicated.
Which is managed by the WorldSettings
I already have a custom world settings, but when you define its class iirc is used for all maps
it is, but again - what needs to know when the gamestate is replicated
UI, player character and voip stuff
and if any of that is driven by any kind of actor(s) then you already have that information
BeginPlay
again, BeginPlay isn't called on anything until the gamestate has replicated. You do not need to listen for a delegate anywhere, you just override beginplay in any actor you want.
And i can check if actorhasbegunplay to see if its good?
to see if what's good
there's nothing to check, if BeginPlay has been called on an actor then the gamestate has been replicated. End of story.
What
The GameState wont exist prior to BeginPlay anyway
if you want to avoid executing OnReps or other logic until BeginPlay is called then yes, you can check ActorHasBegunPlay
So how do you suppose you will use it before that point?
I wont, thats why i say to defer
So then wait for BeginPlay...
Yes but it might be valid or not valid
Huh?
The only annoying thing in the engine is that there's no delegate for the player state becoming valid on the client. At least you have the begin play guarantee with the GS
There are things that replicate before game state is valid and sometimes they replicate when its not valid
You cant guarantee order
So? You account for that
So you have to account for the 2 cases
At least begin play is guaranteed to have a world with a valid game state
That doesnt happen with the player controller, which is another dependency, so i would need to validate both
But its just a matter of syphoning to the same place and make sure both are valid before executing the logic
Ill do some tests
Thanks for the help
You have onrep_playerstate in pawns