#multiplayer
1 messages · Page 137 of 1
…
it can probably be dedicated but whos gonna host the dedicated server?
isn't that plugin just using Online Session Subsystem
confirmed it still works (on my ue5-main fwiw)
Surely
It is
So match making can’t happen on listen servers no?
It can, I already answered that
you will have to create a backend I suppose? Why are you pursuing something like that if you are an indie dev
The same reason all the others before them pursue it
i dont know what you did with the fastarrays but what is going on there
Cause they think they are different, can make the leap and they don't believe the people who dealt with this for years when they say it requires a bigger studio and money.
And then you never hear from them again
this is the fast array replicating a list of transforms to the client
the client then just takes those and applies them to its local versions of the thingies
if a game developer brings out an original game idea they can succeed
just like battlebit did
The result was pretty bad because it slows down a tooon when you send many changes in each frame. Like... 1~ received update to the value on the client a second
with your stand point you wont make it far in life man
for things that don't update as often it will work muuch better
I won't what?
?????
you move actors like that
they aren't actors... but that's not the point
You should asses your limits too tho, don't think that you are more special than others
im just looking to use it for an inventory system
technically the thing that replicates them is a single manager actor for me fwiw
a kind of a "replication manager"
but the fastarray itself should work on whatever, this is just to help with the boilerplate crap
the thing with Indie multiplayer games is you don't hear about the ones that don't get far... 😅
right now i have one fastarray for each player that is supposed to manage one inventory only
i know
so there's a bit of survivor bias, but I still want to make a cool co-op game so I get to suffer with multiplayer lol
when people stay persistent and original they can achieve
not always, there are more ppl that failed than succseed
I think having one per player is just fine... you won't be pumping inventory state every frame a hundred times like I am for these transforms
this is true
Sure, but the number of people who do is really, really, really, tiny. And going for something that is financially almost unachievable doesn't get you far.
but i saw people that made shit games and made good bucks
I lost about 26,000 dollars already
it's a good mindset to have but try to keep it realistic, don't go too crazy with limited time and resources
just continuing cuz some people already supported the game in the past
and don't burn yourself out...
right now what im trying to is i have this ambitious project and sit through it
and this way i learn ue 5 cpp well
I'm still kicking my self till today for having an ambitious project
just these tarrays right now is really kickin butt
I think there is a large diff between an ambitios project and outright trying to do something that hasn't worked out ever before.
where did someone ever state the impossible here
you took this guys multiplayer dreams in one snap of fingers man
They will pursue their dream either way, don't worry
Doesn't change the outcome though
it feels like bucket crab stuff sometimes but... too many scary stories to want to not caution them
positive vibes only baby
we got ppl trying to make GTA or MMO
Nothing any of us make will be that wild lol (in scope and schedule)
some with bp only
most of them are solo dev too, and they get offended when someone said it's outright not doable
yea thats crazy indeed
but let them try why not
no one stopping them?
even if it wont work haha
Solo Devs without C++ knowledge, that want to create a Matchmaking-based game, without having much money to spent, just need a reality check.
They can try, but making them aware of the finance part is pretty valid imo
deploying a test server with playfab costs nothing
In my mind if you massively lower expectations a multiplayer game alone isn't that wild:
- no backend stuff
- co-op only, client trusting for many things
Is my idea to reduce the complexity of it
Yeah but what does that help? If you want to actually release the game, the test server is redundant
The main point is the financial commitment
A massive, massive amount of bullshit is removed if you don't need to make a competitive thing imo
Wow wow 😂😂😂
thats how battlebit did it
playtest hype the game
boom
if it doesnt work out you shut down the project
but atleast try
i saw people make games from sgk v2 and make money HAHA
i believe in everything now
Removing competitive usually removes the need for Dedi Servers, which is a good start
Yop, the multiplayer part can still be brutal, even for co-op games, and will extend the dev time by a lot, but that's usually fine if time is not an issue.
if you make a good game you can survive of of community servers just sayin
Ark ForEx
yes sir, making a good game 🫡
I think the argument of "when you make a good game" is kinda lame
Pretty sure for one there were a lot of good games that failed.
And then "a good game" is very subjective
Let alone the fact that "making a good game" is not that easy after all
Even objectively
oh yes it is
Sorry for bumping the question one last time.
It doesn't seem that Steam actually give out pings to session?
the solution I find online is, the OP end up pinging each of the session him self by sending packets and getting the RTT
Are you using SteamSockets ?
creativity is key to lock the plyer into your game world
I assumed no. What's that 😄
does their session struct not have anything? is there some other readback thingy?
It does have pings in ms
Buddy, just concentrate on your FastArray stuff and let's leave it at that.
but for steam it will return 999999
So Steam has an "old" and a "new" NetDriver
Quotation marks, cause the new one isn't just a few weeks old
so someone do the digging and I think he said something down the line that steam doesn't actually provide session ping
we can get it once we are inside the session ofc
If you use the SteamSockets NetDriver, you should get Pings
If you actually join the playerstate should have it at least :U
I will look it up. Thanks guys
Na it's about the Session Results
Yeah joining is totally cool, it's the sessions results
The old Steam stuff never fills the Ping
And the default value is 9999
I fixed that last time on "Bang on Balls"
By using the other thing, which is SteamSockets iirc
Tyvm, gonna look it up 👍
what you working on anyways at the moment?
I have a regular unreal-related job and I do personal projects on the side for public/personal stuff
personal stuff is mostly messing around, I'm still fairly new to multiplayer internal trivia as I only really started to look at that stuff a year or so ago
I still fumble remote role stuff all the time lol
(pins in here helped a lot)
why is my project looking like this when i press play, I also can't seem to move around or jump.
even on package version of the game.
- Is this #multiplayer related?
- What exactly are you referring to? The clouds? Generally low settings? Anything else?
well the project am working on is multiplayer related as for this bug am not sure where to actually post it or what it is related to in first place.
basically the game will look blurry and glitchy as I can't move around either
is this a fresh project? if yes check your drivers and verify the intergrity of your engine
thats not settings related
im noticing that a level loaded actor is beginning play after it's already been destroyed by the server (I think). Thus some of its components are invalid, causing the client to crash, is this even a thing or did I fuck up very badly?
one should be able to assume that all default sub object components are valid during begin play, right?
Are u possessing the character? Is the input mode set to game?
Is IMC setup on posses?
Honestly, not sure.
BeginPlay can be called very delayed, cause it's mainly triggered by the GameState from outside
It's questionable if the BeginPlay call would already be filtered if the Actor is invalid
I have bug in multiplayer too. On join, the mesh is a hair on the floor 😦 . But they get updated once the char move
Not sure if the Actor could enter a state where the Actor is valid but the Components aren't anymore
welp like Drizzy mentioned, it is a fresh project so ya I have not messed with the normal stuff, it just seems the project itself is acting weird for whatever reason >.> ama just try to create new project and see if it is causing the same issue
Interesting, probably not for the root component (its never been a problem), but ever since I added an attachment to that root component...
Well if u are doing mp and testing on mp, you want to move adding the IMC from begin play to on posses
:D what
I will show sometime when I can take a video 😄
Is the Component in general invalid?
I'm just asking myself how silly a if (!IsValid(this)) return; line would be at the start of begin play
There are serialization problems ones every blue moon
I would say you shouldn't need to do that
ooo I see, well good to know
i think so, the pointer seems to be null
And you created that Component as a DefualtSubObject?
indeed, under a FApp::CanEverRender scope though, since it's a component just for rendering
Was OnPossess not Server only?
I figured out my fastarray is working fine but the logic behind creating the inventory is not working or completely absent
Eh?
inside the constructor:
If you have conditions for the Object to be created, then you gotta ensure that the Condition is also implying that it's always valid on BeginPlay, or otherwise limit it to the same Condition or check if valid
You must be right 🤔. Actually can't remember why I suggest that. My bad
If it's Blueprints only, you can recommened the OnControllerChangedEvent, that calls on Server and Client and can be limited via IsLocallyControlled
But begin play is too early as well for imc setup
Since the actor not possessed yet
It's a common problem in multiplayer afaik
Actually I m not sure. I just tested my mp game
And I have them in begin play
So nvm that can't be it
@dark parcel BeginPlay is too early
Cause you only want to hook up Inputs locally
And IsLocallyControlled is not guaranteed to work on Clients when BeginPlay calls
Cause the Client doesn't know that the Pawn is possessed yet
Hence the OnControllerChangedEvent, that calls when the Controller is valid locally, so you can use IsLocallyControlled
okay, I concluded that FApp::CanEverRender seems to return 'false' on clients that haven't yet fully connected (at least when used inside level actor constructors during seamless travel)
thats so not what i was expecting from something named 'FApp' :(
So you use that cause the Server is a Dedicated one and you don't want the component on that?
yeah, just trying to avoid bloating it up
not to my understanding, since FApp::CanEverRender returns false both during construction and begin play on a dedicated server
the inconsistency is only for clients, where during construction the component isnt created (CanEverRender returns false), but on begin play, it returns true, and thus enters a code path that assumes the component in question is created
There should be a preprocessor macro for Server vs none Server
Wouldn#t that help you more
it def would
Idk if there is one for DediServer specifically
But #if WITH_SERVER or rather the NOT version of that
Would probably help?
it might, i'll have to do some checks
but yeah agreed, preprocessors are the way to go, ty 💪
https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/HowTo/SteamSockets/
This is definitly the answer 🙏
How to enable the Steam network protocol layer for Unreal 4 projects.
💀 the boob jiggle
The main thing is that the Character doesn't seem to replicate when not being moved
We had similar issues in The Ascent after teleporting a Character
Can't recall what exactly it was
How do you replicate that mesh?
I assume via some OnRep?
No replication yet, I just got joining to work. They are just loading the mesh from the local game instance save file
it's Async load, dunnoe if that's an issue. I mean it happend on single player too when they are not rendered to screen. Kinda weird
Hm, not sure
Thx anyway, I'm gonna try to get the ping to work first. Another problem can wait for another day 😄
What happen if call Server RPC in HUD?
Client is own the hud but server doesn't have client hud so, I think Server RPC is ignored is this right?
can an actor have a replicated pointer of another spawned actor that was spawned by the server?
HUD isn't replicated, so no RPC would be sent to the server.
So long as both actors are replicated, yes.
hmm im having issues with late joining players not seeing it.. would it mess it up if the actor with the replicated pointer got loaded in before the actual actor it was referencing?
Thanks
Yop, that's what you have OnRep for
Hello everyone,
I am having an issue with my clients controllers not facing the PlayerStart rotation. I tryied to set FinishRestartPlayer in AGameModeBase with no change.
NewPlayer->ClientSetRotation(NewControllerRot, true);
NewPlayer->SetControlRotation(NewControllerRot);
They are always facing the (0,0,0) rotation, even if the values of NewControllerRot are correct.
The Pawn is spawned in the right direction but not the client controller (on server I don't have the issue)
I saw multiple forums on this issue with no explanation, can somebody please help?
Hello guys, a question, I created an inventory with blueprint which in addition to storing items allows you to drop them, the question is: I want to use the inventory in a multiplayer open world project that you recommend I replicate in addition to dropping the items? Is it necessary for the server to know the number of items each client has in their inventory? Do you know any source of information about replications where I can learn? thank you
As far as i'm aware, the server should be the one responsible for doing pretty much anything inside the inventory except UI stuff, the server should know what each player has in their inventory and should be responsible for updating the inventory when picking up/dropping an item, you dont want the client being in control of what it can and cant have in their inventory to help prevent cheating
The client can be the one to request the action, but its the server who should be actioning it
If you haven't done any multiplayer before you should read the network compendium which is pinned in here
Of course, that's what I thought, giving that responsibility to the client, I was exposed to them being able to cheat with the items easily.
I played many multiplayer games, where is the information, can you be more specific please?
Playing multiplayer games != developing multiplayer games
Read the pinned posts to get up to speed on things
Server should be in charge of keeping track of which items each player has in their inventory, but the client can choose where the items are stored inside of the inventory.
does anyone know how to make private dungeons for each player just like in Albion online in Unreal Engine 5? What do I need to learn to do this?
I need to load multiple levels somehow but not to close the main level. How to do this?
You likely won't be able to find much on this. Unreal's built in networking system relies on all things being within 1 single world. There is a plugin available on the marketplace that can support mutliple worlds but they are not replicated, effectively, they are client-side only, and that plugin alone is priced at $400. In order to be able to facilitate properly replicated worlds it would effectively require a rework of the networking system to accomodate simulation and replication based on the current world, which would be no easy feat.
If you just want to have multiple levels loaded in a single replicated world, then it would involve spawning them far enough apart so there is no overlapping parts and outside of render distance from one another. You'd likely need some separate "gamestate" like actors for maintaining the state of the dungeons. You'd also need to ensure any logic you're running takes only the dungeon and its parts that are relevant into consideration with your calculations.
Using steam socket makes Online subsystem fail to compile :S, I guess they are not compatible
For some reason it compile now but can no longer make a session with advance session
If I had to do that in unreal it would be simpler to just put every player in the same world but control who can see or collide with who
i.e fake it
No one's building an MMO like Albion in unreal though, if they need suggestions from here
Hi guys! I have a question.
How to solve the camera possesion in a multiplayer game? Because, I've tried everything (from creating a widget on begin play, on event init in game instance), there's always a default camera spawned in the level for a second, until the player possesses the character.
So, when the level starts, I can see a random place from the level and only for a second, I'm possesing the character. This also happens, in the main menu. For 1 second, the camera is in a random place and after that my widgets appear. Thank you!
will they(Unreal Engine / Epic Games developers) add that option in future, so it's possible to make something like albion online?
Doubtful
If you ever wonder - just ask, "Will Fortnite need this?" and you'll have your answer.
Does Interface support call server rpc from client side??
I'm implement interaction system using interface and I have some problem.
This is ServerRPC function in IPlayerInterface.
class IPlayerInterface
{
GENERATED_BODY()
UFUNCTION(Server, Reliable, WithValidation)
virtual void Interact();
virtual void Interact_Implementation() = 0;
virtual bool Interact_Validate() = 0;
};
I'm implemented this interface in PlayerController. in order to call server rpc.
And I'm call Interface function like this
void UInGameUserWidget::OnInteractionButtonClicked()
{
if(IPlayerInterface* PlayerInterface = Cast<IPlayerInterface>(GetOwningPlayer()))
{
IPlayerInterface::Execute_Interact(GetOwningPlayer());
}
}
IPlayerInterface::Execute_Interact(GetOwningPlayer()); this function is called in client but Doesn't broadcast to Actual implemented function (Which in player controller)
No
Oh, That's clear answer
May I ask you why?..
Because Epic didn't implement the support.
How did you know that? I've search internet but I really can't find out
Because I've tried it and many others have as well.
You can now join this elite club as well
A vast majority of your code, you'll be calling a ServerRPC on w/e class you're in and then doing logic there. IE - doing the interface call while already on the server.
Can I make a replicated property server-validated somehow? The only way I see to do this is to send a client RPC to the server requesting the change, and then the server makes the adjustment. But I'm losing most of the benefits of having replicated props in the first place. I'm basically in a circumstance where I have like 50 mana, client initiates transaction, server needs to check if they actually had enough mana, then accept/reject the change.
Okay Thanks
Hey guys, I've got a question that I haven't found an answer to for a couple days and it's really annoying. I've got a multiplayer game based on steam and over the top of the player character there is a name tag, and in the lobby, a "host" tag, which are widget components with a text component inside them, each.
I've set up the name tags but I cannot for the life of me set it so that the host tag, which indicates who is the host, appears only above the host for everyone.
Only managed to either make it appear on top of everyone, or on every other player.
How would you replicate a widget component's text so it only appears above the listen-server player character's head, visible by everyone?
That's generally how you want to do things.
Clients need to see the values, so you replicate it to them.
Client makes a request to the server, the server determines what the new value is and sets the value which then replicates it out to clients so they can see the value.
mm going to have to look into batching the rpcs then
unfortunate
You can change the visibility of the component. How you determine whether or not it should be visible could be based on a rep w/ notify bool on the character that you set true:
On Possess > Is Locally Controlled AND Is Server Set Bool true.
OnRep of Bool: Set visibility of component to visible.
Make sure the visibility by default is hidden.
oh my god, thank you so much for this
Starting to dig into multiplayer for the first time... it seems like an array using repnotify doesn't fire the onrep event when an element is removed. I'm setting the array to itself after removing an element, it works but it feels wrong.
C++ or BP?
Using BP but I'm open to using C++ to do things when it's not exposed to BP
How adept at C++ are you?
As you could investigate using a Fast Array, they have much better control and options available for managing replication changes to elements
I'm comfortable enough to use something like that, thanks I'll look into it
The reason is probably because BP OnReps are like PropertyChanged notifiers and they seem to only really trigger from Setters.
In C++ they should work fine.
Maybe I'll just setup the onrep event in c++ and test it out and then expose my own onrep event to BP 😅
I just prefer BP for iteration speed but for core netcode I can see why it makes sense to move it all to c++
is there a best practice for handling both P2P and dedicated server modes for a game?
for example, I have some shared UI that all players look at (game setup, etc.) and it relies on an OnRep_ to change its state. but when I do P2P I just have two standalone clients so those OnRep's aren't firing...
Datura typing a book.
There is no P2P with Unreal Engine. It is either a listen server or dedicated server.
P2P is a completely different networking technology in which there is no central server/authority and state is shared between all players.
The only difference between listen and dedicated is that there is a client playing on the instance that is acting as the server, so you can't separate logic that "only should happen for clients" or "shouldn't happen on server" such as using "Has Authority > Remote" to try and indicate it needs to execute only on a client as the server is also like a client.
Just trying to word things right 😛
I expected a longer message 😅
interesting. so if I do two standalone clients and use sessions to join them together, what happens? one converts into a listen server even though it was run in standalone originally?
Sessions are not the same as connections
Sessions only hold the info about a connection/game
To connect players, one has to open a level with the listen option
And thus becoming the ListenServer
Which will cause it to listen for incoming connections etc
Others can then join it. Sessions are there to make the finding and joining a bit easier
But they are mainly an addition
if I run OnlineSubsystem->GetSessionInterface()->CreateSession(0, FName("GameSession"), Settings); it seems to create something that another standalone client can connect to
Anybody using the Network Prediction plugin or is that dead? I'm using Character and GAS, but that could change if the prediction plugin has enough value.
is that automatically running listen for me?
(also, given this, I'll reframe my question to: how do I write code robust to being both a listen server and dedicated server if I need logic in an OnRep?)
it's dead. it's being folded into the physics system slowly but surely but there's no good solution right now
first deliverable seems to be networked physics prediction (in 5.3 and marked very experimental) and then Mover2 to put CharacterMovementComponent into that system. GAS I'm sure eventually but probably a few releases away
Understood. I guess I'll stay the course then and do what I can for prediction on my own. If they do eventually support character component and GAS I'll already be using them. Thanks!
yeah that's how I've been building too. CMC transition is documented here: https://portal.productboard.com/epicgames/1-unreal-engine-public-roadmap/c/1281-mover-2-0
GAS is a fan favorite and I'm sure everyone wants to port it to something sensible once prediction stabilizes
That only creates the session
If you don't also start listening, no one can actually connect
Listening is like throwing a party at your house. Session is posting your address with the party invitation on some public wall so everyone can read it and find your house.
makes sense. plus some NAT punching I've heard
Yeah depends on the subsystem
what do I do about this ReplicatedUsing snafu? I've been developing in dedicated server mode and now I have a minor mess on my hands
But steam for example also gives NAT punching
OnRep in c++ only calls for clients
Do you usually start listening after creating the session or before?
If you want to code for both server versions you will need to branch where you set your variable and also call the OnRep manually for the listen server fwiw
bah that's so lame
After, but doesn't matter I guess
the session creation can fail so best not to load the new map and listen until you know it worked IMO
Yop.
That's the thing. Saw on Redpoint's that the recommended flow is to listen before you create the session
Starting the session on the other hand no clue
But yeah I'm taking it with a grain of salt
I listen anyways before for other reasons
in a listen server, will I get OnReps or is it treated more like a server than a client?
UE by default creates and starts before listening
Since I need a NetDriver for ForceNetUpdate to work basically
Server
yeah I mean I see the race condition if you advertise the session and listen after. so it makes sense
sigh. this feels like a clear source of bugs if I need to do everything twice but w/e
UE tries to connect for a while. That race condition should barely happen
Maybe. I don't see the big issue tbh
At least never had any issues with this concept before
do you just hide all of the props behind a SetXXX and call the OnRep_XXX in there?
Usually yeah, also cause I use PushModel anyway
So I need to mark the property dirty
oh fascinating. ok well off to create a bunch of setters then. you're right that it's not a big deal but the conversion is annoying -- I'm sure there are some "if I'm in an OnRep, I'm the client" assumptions that I'll discover soon. good lesson for the future
Can also just call the OnRep all the time and filter out dedi server in the OnRep. Doesn't really matter
yeah that's what I'll do, just means I need to be a bit chattier in these functions
For your own code you have the option to call the OnRep anyway
Epics code however yeah
You will find lots of things that will be annoying
Starting with stuff like OnRep_Controller
oh shoot right. I set the player name and do stuff on rep. bah
Standalone is not network though
yeah I thought maybe they put the same if statements in to call it in standalone
And I'm not sure. Don't think they do? They do in BPs but that's a different story
yeah I know about the BPs. which adds another divergent behavior lol
In theory OnRep is used to notify about the replicated property having changed on a client
well I'll see you on the other side
So assumption is that it wouldn't call in standalone
yeah I get that architecturally the problem is that it's easy to use ReplicatedUsing as "have client react to a change" and then when the calls stop happening it screws up your logic
Calling OnRep by hand on the server is in theory also against the design. One would rather have a function that the OnRep calls and that the server can call manually. But it's easier to just skip that function and use OnRep
or, it does for one of the players in the group but not the others 😢
yeah for sure. the middle function isn't doing anything
last question: can I RPC to myself if I fire a server RPC on a listen server client?
Yes
phew ok, thanks
It is handled as a normal event
Same the other way round
There is a chart in my compendium
That explains that
pretty sure thats not available. steam doesnt give you this information afaik
If you have Steam Sockets enabled, then you wont be able to resolve their IP. Traffic is routed through a relay server. Thats pretty much the point of it, to mask IP addresses.
Dedi + Steam Session has nothing to do with Steam Sockets in this context.
If I use Steam Socket, I can't use Advance session? When I travel to map, I just get booted back to main menu
If you didnt connect to the Server with an IP address, you are using Steam Sockets.
the steam sockets plugin doesn't work with steam sessions when i tried it oddly enough
For me, yes
I meant @distant talon
i'm trying to use Steam socket so I can get ping
Funnily enough it seems to apply to both
steam sockets doesnt work with the steam online subsystem when i tried it ages ago
I just gave up today trying to ping server results =(, skill issue I know but there dont seems to be an easy way to ping sessions
you certainly don't need steam sockets for ping, i believe a ping value is right on the playerstate
Yeah but that's once u are in the session, I need the ping for server browser
was told to use Steam socket, so that's what I tried today but don't seems to work with Advance session
I use this node from the session result structure in my server browser
using advanced sessions
steam sockets is a totally different tech from the steam subsystem as far as i can tell
it will return 99999 right?
Hmm, it works fine here
hmmm not for me, and as far as I know steam doesn't actually provide ping if we use the steam net driver
haave to use the steam socket's one
some ppl even go as far as writing code to send packets them self and getting the RTT
Ah, i see, i don't use the steam net driver i don't think. here is my plugin config, i'm not using steam sockets at all, only the subsytsem.
I suspect the relaying only happens on steam sockets, i don't have a solution for you (other than just ditching the steam sockets/driver)
I know it works for lan
well I'm using steam soo =(. thx anyway
i can live w/o it, rather focus on gameplay more than spending more time on this
one question replicating health states, normally before i knew about FastArraySerializers, i would have just replicated players health variables, on the component itself but im thinking that might lead into performance issues considering an amount of players and all the variables being replicated.
for example this blog:
https://vorixo.github.io/devtricks/network-managers/
does it with the help of FastArrays and a Helth network manager actor.
before that i would have never thought about storing the Data in an Array.
what should be my go to.
What are the limitations with listen servers (player hosting games) compared to dedicated servers? When is a dedicated server required?
Listen servers are more resource intensive in that the machine that is hosting the game is also having to visually display things where a dedicated server wouldn't as it's essentially headless. This means you can typically fit more into a dedicated server than you could on a listen server under the same CPU and RAM configuration. If you're running the dedicated server and also connecting with a client on the same machine, then you're probably using up more resources overall.
Dedicated servers aren't strictly required, but in certain circumstances they'd be the only valid choice, for example, if you were choosing to host the servers for players so that players can't spoof your backend systems (like leaderboards, or persistent player stats), and otherwise avoid cheating as a listen server host is technically in control of the game and therefore can cheat without any consequence.
Thank you I understand it a lot more now.
Network managers also have their downsides.
I would not use a Network Manager for Player/Pawn related state
You lose other optimizations by using a Network Manager, like Relevancy.
Or at least, you need to be less strict about it.
Everything is a tradeoff.
values like food and drink would have to decrease runtime. would cause a lot of traffic that way wouldnt it?
Do you have to send those to everyone though
Could just send them to the owning client
I think you need to get a better grasp on the broader scope of networking in Unreal and the tools available to you before you worry to much about optimization.
When you know what and how things can be done, you get a better understanding of how to optimize those things more effectively.
Right now you are just making guesses with no base understanding.
it was not a guess but more a question
if this wouldnt happen server side players would be able to cheat more easilly
Network managers are best suited for a large amount of relatively non complex Actors that need only property replication.
Not even sure how this comment is relevant to the discussion we had above?
Think of things like, Doors, Foliage Instances, possibly Projectiles.
But it all depends on your games needs as well.
A choice of a particular optimization depends on a lot of factors.
how would i enable this by default in the project settings
if i change it would it stay forever?
Hey guys, where would be a safe place to make a call on client when joining?
Trying to look for something like OnControlledChanged , but can't seems to find the event
gonna skim thru the compendium
Event handle starting new player
You have a ref to the joining controller
Rpc your call
Run on owner if you’re only needing it to run on client
It’s safe to trust with server travel
Vs event begin play on the controller which won’t get fired again unless your hard loading
yup, but when is it okay to call it? on PostLogin, I suppose?
Event handle starting calls from gamemode
By default
Create a client only function in the controller
Create an interface and link it from an rpc
Or direct cast
Your choice
Just an FYI for anyone having issues with later engine versions and online subsystem steam
This resolves the issue that popped up where listen servers could no longer return session results
LogOnline: Warning: OSS: Async task 'FOnlineAsyncTaskSteamFindLobbiesForFindSessions bWasSuccessful: 0 NumResults: 4' failed in 15.096867 seconds
Before UE4.27.2 the FindLobbiesForFindSessions result would return regardless of if you were hosting a friends only session, in a null session (standalone) or a client within a session.
This returns that behavior
Can UE5 work with relay servers?
I couldnt find much when looking it up, just want to know if it's possible to do without big amounts of development to get it working
do on_rep notify (c++) fire during first time replication? 🤔 (say, I just joined and received an actor, all its on_replicated methods will fire?)
Hi, do we need to manually call AddReplicatedSubObject with uobject children of the root subobject ?
Hey guys am having a minor challenge
When I seamless travel to another map the game mode is not changed to the particular game mode I want that map to have
It’s still having the lobby game mode
Help please
Then you either failed to travel to that map, or that map doesn't have the right GameMode class configured
For every UObject basically, yes
yes, if the value received is different from the one on client then yes
If EOS already allows them, then yes
I havent looked much into online subsystems and all of that, kind of leaving it till the very end when i'm planning to release, I shouldnt be confident knowing I can make relay servers with steam then right?
Ok, so if i have an array of uboject in a subobject, i have to loop over it to call the function on every item ?
when a new actor is replicated for the first time, first the actor spawns with the default values and then it gets all the values inside of it replicated (thus firing the on_rep)?
or does it spawn with the final values and skips the on_rep? 🤔
on rep functions are not skipped, and there is no order guaranteed
there is postnetinit if you want to make thinkgs on the net initialization
Mr wizard ave always seen ur article mind if we become friends? Got a lot of things to learn from u
Well I trvalled to the map and I configured that map game mode but when I sue the lobby menu to go into the battle map the … game mode is still the lobby menu game mode and not the battle map game mode
Yes
Just checked steam also has their own, and it's enabled by default for p2p. For dedicated servers you can decide.
Ok thanks !
Awesome, thanks
I'm guessing unreal already has integerations with it
PostNetInit gets called after the values have been received from the remote host, and it calls BeginPlay. That only applies to dynamically spawned actors though. Static actors are excluded from this guarantee
Read my last article, goes in depth over these guarantees
Of course, we are speaking unreal here
Savage.
Mohmd
I hope I will up to the socialism par, but yes sure
U don’t accept friend request
Something is misconfigured on your end
These stuff are pretty straightforward
Anyways back to topic when I create match I travel to the battle map but I can’t control my character and the game mod there is not the battle game mode I have tried and tried nothing
Like ….
Indeed, my system of acceptance got criterias, sorry 😛
Not sure, needs debugging
Lol and I don’t meet them 🤓
Not yet
Am using a plugin
Not sure how this info helps, but if you feel it's related and plugin owner has help support, you can always reach out to them
You have a nice Sese of humour just subscribed to your your YouTube
Hello! I'm trying to add Steam Multiplayer in Unreal Engine 5.2.1
For some reason this works on my computer (connecting two instances of the game), but when I run the compiled game on a friend's computer, it doesn't find any sessions. What am I doing wrong?
I'm not sure if where you're doing it makes a difference but I do all my session stuff from my game instance class, I just have the widgets call to it instead of the widgets having that functionality
If you wanna keep the functionality inside the widget then try changing the GetPlayerController's to GetOwningPlayer's, when you're using GetPlayerController that takes an index its only going to be whoever the first players controller is at index 0
Two instances on the same PC is probably not using Steam
Steam would require 2 PCs or at least a virtual machine
You can’t see your own session as steam subsystem will filter it
Also if you start in a session by default ue5.1 might suffer from the same issue ue4.27.2 has
I fixed and linked it here
@potent crescent
If your hosting a listen server by default meaning your starting a session in your game instance before trying to find other sessions it “might return false after timing out” if it’s bugged like ue4.27.2 is
[2023.12.13-01.45.00:098][828]LogOnline: Warning: OSS: Async task 'FOnlineAsyncTaskSteamFindLobbiesForFindSessions bWasSuccessful: 0 NumResults: 4' failed in 15.096867 seconds
Check your logs for this
In this case the sessions are found and incrementally added to the array and logged via numresults but the task times out and returns false.
Thus the event execution returns failure for the node and the struct returns empty
It was introduced here in this commit
I’ve reported on UDN as well
is it easy to create simple multiplayer game? I just watched a tutorial and it seems like theres inbuilt blueprints for hosting a session, joining leaving etc.
In Unreal Engine 5.0.3 after you call Execute Console Command: "ServerTravel Map" everyone is sent to the destination map but all the widgets are still on the screen.
That isn't the case with Unreal Engine 5.3.2. When you call that, beside the fact that you can now use it in editor and not having to use standalone, all the widgets are automatically removed. The problem is that I want them to still stay on the screen and remove them later manually. Is there a way to force them to still stay on the screen?
In theory, that they stay in 5.0.3, is already not really good
Epic, ages ago, enforced removal of Widgets on Travel, because when originally introduced, they crashed more than anything else, due to people keeping Widgets on the Screen that had references to the World, which due to the Travel no longer existed
I don't actually know what removes them, but you would want to breakpoint the Remove code in C++ I guess
"people keeping Widgets on the Screen that had references to the World" I can see that being a problem if you don't do it right, but in my case I want to keep on the screen a widget that only has "Loading" message
You mean a Loading Screen?
That is usualy done differently
Loading Screens, if done right, use the Media/Movie System, and iirc also only really support Slate
mostly because when the new map is loaded there is a split second were the camera is set to 0,0,0, or maybe there is a fix for that and I don't need that loading widget
Not sure if there ever was a proper plugin
Think Nick Darnell or so had one or at least tried to make one
Yeah, that's what you use Loading Screens for usually
Which have the option to be removed manually
hmm I'll look into this then, the widget was easy and I knew how to do it, but if this is the proper way to do it, I'll try to see what can I do
Thank you!
In this tutorial I'll show you how to properly setup a self-contained Loading Screen System for your game - which will allow you to safely play movie files, audio clips or load a widget to the screen during any type of map loading.
Don't know how up to date that is
But iirc Loading Screen without C++, like an acutal one, is not a thing
With a bit of luck you can just copy paste most of the stuff in the tutorial I guess
My game is mainly blueprint, but there were times when what I needed wasn't available in blueprints, so it is fine, I'll just use C++ for that
it doesn't seem hard, so thank you again!
No worries
The really hard part will be the Widget
Cause iirc this requires Slate
Hey guys I'm making this game where players can hit and damage each other, but I have a problem. In the game, there are two levels: pre-game lobby and actual game map and I want players in lobby map to hit each other, but not to take damage from each other. On the other hand, I want players in actual game to hit and take damage from each other. Right now I have implemented a bool variable in Player Blueprint if player can take damage. In each level's Level Blueprint I made a reference to player's blueprint and set the variable as in images below.. But the weird thing is that only Client can take damage from server, but server can't take damage. I don't know how to fix it so I'm writing here. Any suggestions?
You can't use Get Player Character 0 in multiplayer reliably as it attempts to get the first known character which isn't necessarily the one you want, and even less so if you're trying to use the level blueprint to do this as there's no way to get a reference to a specific player when they're entering the game in the level blueprint.
Additionally, damage is normally something you want handled on the server. This appears like you may be doing damage locally which could end up with health values being unsynchronized. You shouldn't need to have a client tell the server what montage to play either, the server should know what montage to play and possibly multicast it to others.
If you want to have something that prevents damage for all players individually, based on the current map, you can have the map set a bool in something like the gamestate which is more accessible to other actors. Using OnPossess in the character (which only runs on the server), you can check if the controller is a player controller, and if so, read the bool from the gamestate, and if it is true, set the bool in the player character. Again, making sure that your damage function is only running on the server, then the damage shouldn't be applied to any players.
What’s the best matchmaking/lobby system tutorial for ue5.3?
Hi, I've got a spectating system set up so when the player dies they start speccing other players but i want the spectating player to be able to see any post processing effects that happens to the player they're spectating, right now im doing some post process fx when the player gets into low health states but the spectating player doesn't see them because im only running them on the owning client, how can i go about making it so that the post processing fx also replicate to any currently spectating players?
Thanks for help I will try this
Okay so do you suggest I make a bool variable in game state and what about the map set?
Yes.
Create a "Disable Player Damage" bool in gamestate.
On begin play of the level you could get your gamestate, and set that bool true.
In C++ I couldn't figure out how to create a widget for multiplayer or how to integrate local control. Could you please enlighten me
Okay just did that and with the same result as before. Server can deal damage to client anytime...
And if I set the bool Disable player damage in gamestate to false, players cant damage themself anywhere
I have one more problem. So when listen server pressess leave button, the session should destroy... and it pretty much does, but client stays in it and that session could not be joined anymore... Also Im using advanced steam sessions v5.1. Any fixes?
Did you change OnPossess on your character to read the bool from the gamestate as well so that it sets your "Can Take Damage" bool correctly in your character as I suggested earlier?
wait do you mean event possessed?
this is what I did
Check and make sure you're reaching these nodes. You can put print strings or use breakpoints. If you're not reaching there, then your logic beforehand isn't setting the value.
The branch in the middle here is also redundant as it's checking whether or not BP_GamePC == New Controller which is what you're using in your cast anyway, so if the cast failed, it wouldn't reach this point, otherwise it would always be true.
Okay so apparently on listen server the Can take damage checked is running, but on clinet can take damage not checked is running
It should only be running on the server as Possessed only runs on the server.
But in the main game map it works as it should
hey yall simple question as I have not worked with networking before. Would resolution scale (r.ScreenPercentage) affect packets in anyway, and is there a good way I can test this?
My hunch is that unless you're running a custom render pipeline, the screen percentage step in TSAA wouldnt really be a part of networking, right?
if you're playing online with a cranked screen percent then maybe the hardware could lag on drawing frames which would delay packets, but it wouldnt like, ADD data to packets right?
With fast array replication, if I get notified when something is added, removed or changed is it possible to get the actual item or index? From what I've seen it only gives me the array that was changed
Shouldn't you have a callback calling inside the array element struct or so?
Do you mean an rpc or delegate that I call when these things happen?
there is a fix
I've outlined it somewhere else but essentially you create a custom LocalPlayer class
inherit this as a child of your actual class
then in the constructor set that class cameramanager to black
hard set
then use a fade in function on your actual controller after the rep takes place and you transition from the local player class to your controller
you will see the localplayer class in your project settings
#include "CustomPlayerController.h"
UCustomLocalPlayer::UCustomLocalPlayer(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {
PendingLevelPlayerControllerClass = ACustomPlayerController::StaticClass();
}```
Something like this ☝️
ACustomPlayerController::ACustomPlayerController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
PlayerCameraManagerClass = ACustomCameraManager::StaticClass();
}```
{
SetManualCameraFade(1, FColor(0), false);
}```
This will ensure the localPlayer Class also has the fade effect you expect and see when you are possessed by a non "server travel" client for that brief period of time "PendingLevelPlayerController"
The LocalPlayer class has to be a C++ class I believe but everything else can also be done in blueprints if you prefer
You won't see the 0,0,0 because your fade-in wont happen until your posessed by the non local controller and the localPlayer controller essentially is solid black.
I just lost the last three days of progress I had on my project 🫠
Is it because you didn't use version control?
yah it's my first project and it's purely just to learn how everything works so i didn't bother with it T_T
how??
it should save
Could have been data corruption or accidentally deleted or something else
what do you do if you get a blue screen with ue5?
Unlikely that it was specifically unreal that caused it. What does Windows event viewer say?
Hey guys
It’s me again lol
Am still trying to solve this issue
When I seamless travel to another map the game mod is not changed to the one I set on the map am traveling to please help
is there a reason why it's checked as locally controlled on beginplay but when the health value changes (character takes damage) it doesn't check as locally controlled??
How do you enable CheatManager for clients for debugging purposes in editor?
When i play as client, PlayerController CheatManager is null for clients. Is there a way to have cheat manager for all clients?
i dont know what cheat manager is tbh, but i would assume it runs mostly serverside side and matches data received with server data. to keep values in sync
for example when i use a debug command to apply damage on the client it does to it for about a second then goes back to its original value since it didnt happen server side
Any one?
i have one question particulary about FastArraySerializers.
since fastarrays dont have particular load orders and can be random on each client.
did anyone achieve to sync their slot position across all clients and the server.
i was thinking to try out and give my items a variable int32 that on storage saves and initializes the position its being sorted in.
to then use this variable to organize the UI Display based on that variable.
the reason mainly im focusing on research ways of sorting grid positions in my Array is that im looking to make a spatial inventory using fast array where a gun has a 2x3 slot coverage for example.
in theory this should work but maybe someone tried and it didnt.
Replicate game mode change maybe?
Hmm?
Sorry wah do you mean
The battle map has a game mode and ave implemented that in the world setting but it I seamless travel from lobby to battle map 🗺️ I can’t even control my character
And the game mode don’t change
Debug view modes only work when there is cheat manager instance, for example viewmode CollisionPawn only works in standalone. But it doesn't work for clients, i looked at engine code and it seems it doesn't apply viewmode if cheat manager instance does not exist.
No I mean the item struct should have functions you can implement
if the order the elements get sent over is random, then why not just have which slot they are for as part of the item?
I've never set up a grid-based inventory setup before, if I were you I would consider maybe thinking if the elements can rotate etc in the grid
thats what im implementing right now
bool FRSInventoryList::IsSpaceFree(const FIntPoint& Position, const FRSInventoryItem& Item) const
{
// Calculate the item's effective dimensions based on its rotation and ItemDefinition
int32 ItemWidth = Item.Rotation == ERSItemRotation::Horizontal ? Item.ItemDefinition->Width : Item.ItemDefinition->Height;
int32 ItemHeight = Item.Rotation == ERSItemRotation::Horizontal ? Item.ItemDefinition->Height : Item.ItemDefinition->Width;
// Check if the item fits within the grid boundaries
if (Position.X + ItemWidth > GridWidth || Position.Y + ItemHeight > GridHeight)
{
return false; // Item doesn't fit within the grid boundaries
}
// Check for overlaps with existing items
for (const FRSInventoryItem& ExistingItem : Entries)
{
// Skip checking against unoccupied slots if applicable
// Assuming IsOccupied() is a method to check if the slot is occupied
// if (!ExistingItem.IsOccupied()) continue;
// Calculate the existing item's effective dimensions based on its rotation
int32 ExistingItemWidth = ExistingItem.Rotation == ERSItemRotation::Horizontal ? ExistingItem.ItemDefinition->Width : ExistingItem.ItemDefinition->Height;
int32 ExistingItemHeight = ExistingItem.Rotation == ERSItemRotation::Horizontal ? ExistingItem.ItemDefinition->Height : ExistingItem.ItemDefinition->Width;
// Check if the existing item overlaps with the space required by the new item
bool isOverlap = !(Position.X >= ExistingItem.Position.X + ExistingItemWidth ||
Position.X + ItemWidth <= ExistingItem.Position.X ||
Position.Y >= ExistingItem.Position.Y + ExistingItemHeight ||
Position.Y + ItemHeight <= ExistingItem.Position.Y);
if (isOverlap)
{
return false; // Overlap detected
}
}
return true; // The specified area is free
}```
also im working on a function to mark multiple entries dirty based on the size of the item
that's not really multiplayer as much as just a way to find collisions from a rectangle in a limited size grid
yes
I'm a bit worried sending over items piecemeal will get weird though
if something moves in between the receives things might get weird
I guess as long as it's safe for clients to move stuff around without stuff exploding locally it may be fine
as in a "predicted" move between spaces in the inventory? assuming you even need or want that
if we have a grid thats 10x10
we have a total of 100 entries to mark dirty.
row 1 would be 1to10 row 2 11to20 and so on
based on the rotation position and item size we caculate which entries to dirty.
we have a total of 100 entries so 100 positions to mark dirty, since it can happen that the order is random we have to save additional variables in our fast array like position to then check if an item is occupying the said slot.
when marking dirty we have to make sure it marks multiple entries dirty
we also need an algorithm to check and caculate available free space
as long as the server has the final say, it's probably fine to have to send updates that way?
is this something you need to have locally predicted?
FFastArraySerializerItem has ReplicationID and the comment says "Note that the ReplicationID is replicated and in sync between client and server. The indices are not." I use that on my inventory to identify slots.
FastArraySerializer.h line 186 has explanation how it works
oh, sick
can you define how it creates new ReplicationIDs? that way I could probably skip some extra stuff on mine
I suppose mapping it would work fine but I would rather just raw send the int over (if I can)
No idea, I just create empty slots on a server, and then reuse those slots all game.
they go from like 1 ... 20
whatever your inventory size is
yes, but replication id would not store current position
You could create fixed size inventory, let it replicate, then sort by replicationID?
what the ID means is up to you
if i have 100 entries per inventory how would i use that to make out the position if i have for instances for example
i need FGuid and position to make up which item takes which entries
like i said one item could take up multiple slots depending on its size
I feel like you need the server to control if items can even exist there and then send them when they are in acceptable positions
then just have them... where they are
and mark them for sending then?
yes, the order of the entries is not important, just the position an item takes and how many entries it marked dirty
based on its size and current position
i dont know if it would 100 % work but that would be the logical order
i wish 2D arrays would work with FastSerializer would make everything so much easier
you can treat it as 2d array
having 2d arrays randomly change order from replication order would be... not really a 2d array in intention
just create it, sort by replication id (both server and client) and then just calculate how many slots you overlapped, they are in order now
and yeah, you can just make a bunch of functions that more or less makes it serve as a tarray but with your own mapping internally
if you create the inventory in a loop, it will have rep ids like this : 1, 2, 3 ,4 , 5...
thats what im trying, its called flat array with calculated indices?
it just not might be in that order on client and you need to sort it
ideally the order they come in time-wise doesn't matter, they just go in X position
all you need is how wide a row is and you can just mod% the offset
row1 = 1-10
row2 = 11-20
row3 = 21-30
and so on
a grid would be 10x10 for ex = 100
sure, that would work
100 total entries
I assume this is the worst case of each slot having a small 1x1 thing in there
i dont understand?
if you have a giant thing occupying multiple slots you could send it over and just have it occupying those spaces, the server wouldn't need to send data on slots some giant thing is on top of
unless the items don't have size? I'm confused?
yes they do
width x height
why do you need to send information about slots we know something is covering up on the grid?
i dont understand this question
let's say you have 1 giant 100x100 item that covers the entire inventory
how array items should you have to send?
?
it would mark all 10.000 entries dirty
I think it's possible to only send the actual items and their transforms + bounds, rather than sending dozens for just one thing
I am thinking in terms of like, tarkov or stalker or something I suppose
"slots" is a vague term
yes
paint is wild i just wanted a grid
just draw some lines, sheesh
i quote can you make me a simple grid=
generative UI is probably not going to work for making simple diagrams, especially when you don't ask a direct question? also #generative-ai
I understand what you mean, I just don't think you have to represent every single empty grid over the network
it can just be... empty
aka an inventory with only 1 item in it would only send over that item + transform
and something else maintains the size of the container
so when someone joins they get sent 1000 empty slot indexes over the network for an empty container?
noooo man
where you come up with this from what i just explained
alternatively: an inventory with a single larger item sends over multiple dozen slots for every one that SINGULAR item occupies?
yes for now
yea cause it covers the whole thing
let me figure out the main logic first and then optimize man
these ones? ```cpp
void PreReplicatedRemove();
void PostReplicatedAdd();
void PostReplicatedChange();
//Item Definition
USTRUCT(BlueprintType)
struct RSI_API FRSInventoryItem : public FFastArraySerializerItem
{
GENERATED_BODY()
// --- Identification ---
UPROPERTY()
FGuid ItemGuid;
UPROPERTY()
int32 Count;
UPROPERTY(NotReplicated)
int32 PreviousCount;
UPROPERTY(EditAnywhere)
URSItemDefinition* ItemDefinition;
UPROPERTY()
float Durability;
UPROPERTY()
FIntPoint Position;
UPROPERTY()
int32 Width;
UPROPERTY()
int32 Height;
UPROPERTY(EditAnywhere)
ERSItemRotation Rotation;
bool operator==(const FRSInventoryItem& Other) const
{
return Other.Count == Count && Other.ItemDefinition == ItemDefinition && Other.ItemGuid == ItemGuid;
}
bool operator==(const FGuid& OtherGuid) const
{
return OtherGuid == ItemGuid;
}
bool operator==(const URSItemDefinition* InItemDef) const
{
return ItemDefinition == InItemDef;
}
int32 ConsumeCount(int32 NumToConsume);
};```
I don't have UE available atm
alright thanks. just trying to make sense of how it all works
there's nothing wrong with your inventory struct, I just don't think representing one giant item as dozens of indexes makes sense when you... already have a size? why even have size then?
But yeah, seems to be those 3
UPROPERTY()
FIntPoint Position;
UPROPERTY()
int32 Width;
UPROPERTY()
int32 Height;
UPROPERTY(EditAnywhere)
ERSItemRotation Rotation;```
you dont need these prolly
yea i would figure out a bool operation after to make it less performance impacting rn, i cant think of a singular value that can store multiple numbers
if you know one shout it, and i will try and work on that
i figured this out, in case anyone is wondering, you have to first type EnableCheats, then viewmode CollisionPawn for clients to work.
oh nice 💪
optimal would be valueidk SpaceOccupied = 1,2,3,4
are they in any shape other than a rectangle?
you already... you already did that
unless the size was for something else entirely? I'm so confused
yes thats only the position
item size
are the item size and how many spaces they occupy different ideas?
or, concepts I should say
item size initialy starts from pos in z and y
so can things be on top of other items?
but we need the values inbetween to control and check space taken
why? why can't you just check the other items and if they occupy that range with a bounds check?
no they stack
if its of same item type
maybe just have the items replicated, just like you have now, and then client and server both know the grid size and can just calculate does it fit there or not? what sthe problem, i forgot already
cause it dont work that simple that sadly
you could loop trough items or just manage non replicated array that know which grid slots are taken, and if your calculation says that it tries to go to taken slot, abort
yea im looping through the entries
megafunk if you want i can explain in vc tbh and just share my screen this is hardcore to explain
okay: did you write this code you showed us? did someone else do this and give it to you?
and right now we just bounce back and forth and there is no sign of progression in understanding the issue and why it wont work
the base was written by Kaos only allowed for an item to take one entry aka slot. in a simplified manner
im iterating and changing the system to allow for a grid based spatial approach
assuming items are atomic (they aren't separate pieces in a 2x2 item) there is seemingly no reason you have to send 5 entries to represent items in this pattern:
this is less about optimization and more about it being confusing to have 4 entries you have to manage for a 2x2 item that occupies that blue area
yeah if you just send two items, each with position and size, and you know the grid size, you can calculate if they overlap
now I kinda want to design and implement spatial inventory
go ahead and report back yall fried my brain
more regular #multiplayer question:
are there any real guarantees with rpc ordering/timing based on being at/from a similar net object? Is there some way to tell replication to only send/receive a pair of RPCs together in one packet?
I assume not really, I can cheese things I guess but I'm wondering if I'm missing something
kind of the uh, shape of the information needed to represent what you are doing I guess? if that helps? less unreal boilerplate and more just raw information how to represent that as thingies in a list (sized items on a grid)
i test my current progress and see if it works as expected
Just for little cleaner code I use an Fintpoint
yea indeed, is smarter aswell
i only used it for position rn
Yeah
what you workin on?
I mean just a survival game that is player and ai based, Just want to Finnish it to have some fun w friends
oh yea same here
U having any issues w ur inventory ?
yea
I tried that but nothing shows up with NewTestLoadingScreenWidget, maybe it was changed since then to simply be empty, but at least BeginLoadingScreen is called, as I added a variable and updated it's value inside that function, and after a map is loaded that variable has its value updated to what is inside the function. So maybe I need to make my own Slate widget... that is goin to require a few tries for sure
Reliable ones do guarantee order and timing and indeed only in the same ActorChannel. So an Actor and any subobject attached to it really
If I wanted to guarantee two RPCs are received in the same packet, I would probably make them one RPC instead
what
server RPCs called on the server are treated just like regular functions right?
@brittle wharf
im trying to make a spatial inventory and fast arrays kill it all
Any help with this?
are you doing spatial with an array of arrays?
don't, if you are
why do you even need array of arrays?
you can just do it with one array you have to store the item definition or instance, and the first cell coordinates (x,y)
you can still use fast array for that
why not? does it not allow faster access of data so you can do a[x][y] rather than looping and checking if the x & y match? I guess you can use 1 map<int, item> and have the int be the packed position but is that worth?
because he wants to use fast array
ah
you cant do that with fast array
i know it could work but its to much data to store could just use a 2d array would be the same performance
oh no im using a 1d array, so just one fast array with calculated indices
its still not working tho
Is there a specific method for syncing Instance Static Meshes when a client joins? These meshes are housed within PCG Partition Actors.
I'm a bit confused, I have a server rpc here:
UFUNCTION(Server, Reliable, BlueprintCallable, Category="GameplayEvents")
void ServerTryPlayCard(TSubclassOf<ACardActor> CardActorClass, const FVector2D ScreenSpaceCursorPosition);
UPROPERTY(BlueprintAssignable, Category="GameplayEvents")
FOnCardPlayedDelegateSignature CardTryPlayEvent;
//...
void UCardSubsystem::ServerTryPlayCard_Implementation(TSubclassOf<ACardActor> CardActorClass,
const FVector2D ScreenSpaceCursorPosition)
{
CardTryPlayEvent.Broadcast(CardActorClass, ScreenSpaceCursorPosition);
}
and a not-replicated server only object listening for it
But this does not call from clients
only running on the listen server
What is that Subsystem?
Not sure any of the Subsystems can run RPCs, let alone ServerRPCs
It's a regular world subsystem
UCLASS()
class NECROMONICON_API UCardSubsystem : public UWorldSubsystem
{
GENERATED_BODY()
public:
UFUNCTION(Server, Reliable, BlueprintCallable, Category="GameplayEvents")
void ServerTryPlayCard(TSubclassOf<ACardActor> CardActorClass, const FVector2D ScreenSpaceCursorPosition);
UPROPERTY(BlueprintAssignable, Category="GameplayEvents")
FOnCardPlayedDelegateSignature CardTryPlayEvent;
protected:
virtual bool DoesSupportWorldType(const EWorldType::Type WorldType) const override;
};
oh
how would i be able to host the server myself so me and my friend can play
well that would be a thorn if so hmm
Let's just say I'm faily sure you can't do that and need to run that RPC through the PlayerController (or a Component on it) or similar.
The way you posted it for example
that would explain why it's not working
gunna have to think about how this has to work then
cheers
this only works for people that is on the same internet as me
or do i have to open my ports?
cuz i dont see option where u can choose ip and ports
You are doing two things in that screenshot
You are creating a Session with the Subsystem you are using, which is used to later find said session and join it.
And you are starting to "listen" for incoming connections.
The Session (Creating, Finding, Joining) is just information.
The "listen" is the part that is hosting.
If you aren't using a Subsystem that allows online sessions, such as Steam, then the session part is relatively redundant
By default, the game will listen on port 7777
Steam performs NAT Punch Through, so you don't have to open the port
But without that you'd need to open that port in your Router
The IP it hosts on is your Routers Public IP
Okay thank you I think im using the default subsystem(idk havent touched anything) so basically I just need to open up port 7777?
If you use the default Subsystem, then you are only creating LAN Sessions, so you can ignore Sessions for now fwiw
If you want to join that Game over the Internet, then you have to open the Port 7777 and your Friend has to connect directly to your public ip + port via console command:
open <ipaddress>:<port> e.g open 127.0.0.1:7777
You don't need to add the port to the command if it's 7777 anyway iirc
The Sessions stuff, over Internet, doesn't work without Steam or similar. You'll only find Sessions in your Session List in LAN atm.
Thank you so much im migrating from unity to ue and its crazy to me that ue has these inbuilt functions.
Yeah outside UE it's hard to find an Engine that has this all already available
Even the Replication part
I think Unity is adding DOTS or so, but not sure
Godot has some networking stuff, but I haven't really looked into it enough to know how powerful it is
So I'm quite confused, calling server rpcs from the player controller seem to be valid, but almost nowhere else. What are the requisites for being able to server rpc?
Rpcs need to be called from a client owned actor right?
I haven’t touched them in my projects yet but I think that was one of the requisites when I was reading up on the copemendium/documentation
btw how can i open the console command in the build?
mm yeah this seems to check out
You can define console buttons in your Input Project Settings.
Console is disabled in Shipping builds though
My issue rn is IsLocallyControlled working for my character on BeginPlay but not anywhere else in my code T_T
although
But you can use a "ExecuteConsoleCommand" node and hook it up to your UMG widget with a text box
you can only call rpcs on actors you own
The player controller is also not authority
BeginPlay in Character is too early for IsLocallyController
Is authority and ownership different
Yes
No
Server-spawned Replicated Actors are owend by whatever the Server sets as Owner (either on Spawn or afterwards). Usually PlayerController or PlayerController owned Actors.
Authority is still the Server.
Locally spawned Actor (not replicated from Server) would return true for HasAuthority on the Client though
Can these kind of warnings be ignored when playing in PIE multiplayer when level streaming levels are unloaded?
LogNetPackageMap: Error: GetObjectFromNetGUID: Failed to find outer. FullNetGUIDPath: SomeMeshInMyUnloadedWorld
I don't recall seeing them in the logs on development builds but I will verify in case this could be an issue
So if the actor is not owned by the local player controller it cannot server rpc
that seem correct?
PlayerController or a chain leading to it
And the Server has to set the Owner
And yes, the Client that calls the RPC has to own the Actor
Only one Owner at a time
So like for example, my player state apparently can't rpc
Your PlayerState can RPC
And that's because it's not owned by the local controller?
it can't, and this is one of the reasons I ended up here
yeah they don't execute for some reason
how have I managed to break the player state
xD
My character is hitting a wall or not moving correctly. loaded my working files from last night, rebuilt visual studio files, client side navigation is on. It only happens in client mode. I tried the model and ABP on the mannequin and it worked fine. No idea why I can't get single click motion to work. Any theories? https://imgur.com/a/mR0lDAI
Did they change something in 5.X so that animations on the server are played slower? Having the issue that my clients are playing the animation in normal speed but my server is playing them at a much slower speed
Requires navmesh?
Did you modify the CMC pre 5.X?
@lost inlet do I have to make a new mesh for different characters?
If the client needs the navmesh to operate the movement, then you need to opt in
There's a checkbox to generate navmesh on client @forest reef
Excuse my ignorance what is CMC? Dont think I've touched it
By default navmesh is not loaded on clients
@grizzled stirrup that is set to true, which was working
CharacterMovementComponent
The Server isn't ticking Client Anims
It gets driven by the Server Move RPC for them
So Server migth see Client Anims a bit weird
That's all I can tell you
Oh, would that be dependant on the netupdate rate on the CMC?
I think so, yeah
Unfortunately didn't change anything, really wonder what it could be. I've also enabled it so that the skeletal mesh component ticks on the server and updates the pose, just weird why it would be slower
Are you doing any math that drives animation rate?
Is it all anims or only locomotion
Just state machines, doing nothing to alter the speed or anything
Somehow it plays substantially slower on the server in the preview when I set the instance to be the server character
Preferably I would want collisions to be server side strictly with client prediction to confirm the hit (lagg comp) but if I can't get the server to play the anim at the same speed as the client I'm not sure what I'll do
Used to work just fine in 4.27 but ever since we upgraded to 5.2 it seemed to change
So I created a new character. Copied everything from the working topdown character c++ code. Same mesh, animation blueprint, controller. topdown character works but mine is stuck
Hello can someone explain to me what a headless server is please?
A networked computer that runs with no visuals being displayed, typically without a monitor since nothing is being displayed.
Alright thank you I think I get it now appreciate it
My character was hitting a brick wall in the topdown example because these were not checked
How can I give a player owned pawn to the server?
What do you mean by give?
Server becomes the owner of the pawn
and not the PC
I'm in a sort of weird situation where I want the player pawn to be owned by the server
Why does it need to be owned by the server?
it's an invisible attribute bag
leaving it as player owned basically makes the systems much more complicated
I don't see how. Ownership doesn't really do much apart from handling replication conditions.
"invisible attributes" could just be things that aren't replicated at all.
they are replicated
but everything that's happening is server auth
having the pawn not be a server entity makes it super convoluted
I think you're misunderstanding what ownership is.
If it's a replicated actor, that means it has to be spawned/exist on the server, and server would be the authority of that actor regardless.
yeah I just went through this earlier
authority isin't the issue I'm having
it's ownership
RPC's are dictated via ownership
What issue do you have with ownership though.... Ownership doesn't grant anything special.
for reasons
Preventing replication == you don't want others to see the value.
Preventing RPCs == you don't want those things to be RPCs to begin with.
here's a concrete issue I'm having
This does not work if the pawn is not owned by the server
and I only want this code to run on the server anyways
I have to grant the ability seperately and then activate
Incorrect. It doesn't work if you're not running on the server.
...
that's literally what I just said
this is server code
it should only be server code
No it isn't.. You said:
This does not work if the pawn is not owned by the server
alright
That's the problem I'm having
The question I'm asking is how can I make the pawn owned by the server
You can't if it's player controlled. You still haven't clearly explained why you even need it owned by the server.
Because this code does not work on clients
That doesn't have anything to do with ownership.
hello everyone , does anyone have an idea how does lethal company lobby ship system works?
What do you mean
It's literally an ownership problem
If I have a normal server owned object this works perfectly fine
If it's player owned it does not work
this is the problem I'm having
Here's the thing.... You're running that node, and it's on an ASC. That ASC is replicated and is owned by something that trickles down to being a player.
So whether you have the ASC on PlayerState or PlayerCharacter, it'll point down to the PlayerController which is player owned.
If you're attempting to run something that exists only on the client then it's not replicated. You can't get the server to access it, and you can't add it locally to the ASC as it's something that the server has authority over.
This object is not local, it's a replicated pawn. But the fact it's owned by the player is the problem. Even if I use server rpc's, gas considers the instigator pawn's ownership as the important factor in the security policy
Maybe a better question, what does it mean for the server to own a pawn. Is a pawn that has no controller considered owned by the sever?
Server doesn't really "own" anything as "server" is not something that exists as something you reference.
Ownership is assigned, typically by the thing spawning the thing that is being spawned.
When you're assigning ownership to a "player" what that means is you're usually assigning the owner to an actor that has an ownership chain that leads to their PlayerController.
No.
No ownership = no owner.
That's it.
I can spawn an actor on the client with no owner, that doesn't mean the server owns it.
so when the server spawns a pawn
Nor does it mean the player owns it.
The "server" isn't a thing that exists that you can reference. Neither is a "player". The only way you can reference a player is by their "player controller" which represents a player. There is no such thing that represents a "server".
okay so i have a Charcterblueprint which is used for both client and server i have everything thing replicated to work but im having a issue,i have a sniper which is a child of the ak actor in picture and i made a render target with 2d camera to make a zoom in but as you see in pic the clients texture is the server scope also not indivual how do i get so server and client see there own @sinful tree do you know anything about this i know you help me before with a issuee in past
I can clearly spawn things on the server
yeah that's my question
is it just when you return nullptr
ex
const AActor* APlayerPawn::GetNetOwner() const
{
return nullptr;
}
UPlayer* APlayerPawn::GetNetOwningPlayer()
{
return nullptr;
}
is it implied this belongs to the server
So there's no possible way to fufill the net ownership for GAS?
the security policy is just their for kicks?
The engine itself knows if it is the authority or server under the hood.
Yes friend this is what I'm asking
But the "server" is not something you can reference.
The world netmode.
can't be
I'm running on a server rpc
but it's using some credential of the insitgator
In order for a client to be able to call this event in a multiplayer game and for it to work properly then the actor must be replicated and they either:
A) Need to be the host for a listen server
B) Be the owner of the actor making this call.
In case A, since it's the listen host, they have authority over the actor, so it will execute.
In case B, if it's not client owned (determined by if the ownership path leads to a player controller) , the server would reject the RPC as the client isn't the owner of the actor.
Then that means the client likely isn't the owner of the actor (ownership needs to be defined on the server too), or, the actor isn't replicated.
Yep
So long as it's a replicated actor, and it was assigned ownership to a player and that player is making the call, it should execute on the server, grant the ability and activate it once. (Not taking into account the activation policy of the ability....)
Has anyone figured out an elegant way to transition from a main menu "level" to a partitioned level smoothly from a client perspective? I am assuming I need to async load actors that will be in the destination level before calling ClientTravel. However it still has a hiccup and I am manually defining all the actors. I would like to provide a grid cell to load all actors from automatically.
yeah I'm really confused
both prints run
but the ability doesn't run
and this is definitely replicated as I'm calling it from the player state in this case
ability just for ref
doing nothing fancy
afaik
yeah same story on a replicated pawn
LogAbilitySystem: Warning: Can't activate LocalOnly or LocalPredicted ability Default__GATEST_TestAbility_C when not local! Net Execution Policy is 0.
Doesn't want you activating the ability because it's set to client predicted but you're trying to execute it on the server.
Window > Output Log
I had warnings filtered
well this was a huge help thank you, I was about to re-engineer a whole bunch of stuff for no reason
Glad we got it figured out 😄
Unreal networking question - how are OnRep functions in C++ timed compared to the setting of the actual replicated variables on the client? Are all actor replicated properties in that tick set to their replicated values, and then all OnRep functions are called, or are they called as each property is changed?
What about with components? Are they all in place before any actor OnReps are called, or are they separately-timed?
this is something you can verify with a well-placed breakpoint
Also, the unfortunate answer is that it shouldn't matter. Properties are not guaranteed to be received all at once - even if you set a few properties at the same time you're not guaranteed to receive them all at once, thus making the order of application practically irrelevant.
ah yep, run into that a few times
Properly designed replication shouldn't care about what order properties are applied in because it makes no such guarantees, and on spotty (and even sometimes good) connections you'll end up with things arriving in weird orders if you didn't plan for it.
I appreciate that. I'm designing a replication system outside of Unreal and trying to understand how it works
So no breakpoints for me, just asking
Hard to find info, the docs don't say it either
(I've used it a lot in the past but been a few years. Can't remember this specific detail)
well you're not bound by how unreal works then?
It's just a reference, I'm just asking to see how someone else does it
Applying all at once may or may not be more ideal, depends on what kind of guarantees you want to make. If it's applied all at once and OnReps fired later then you can assume you have whatever the latest information is in every OnRep, but you then can't assume any other OnReps have fired for that information.
But in the end you still have to design around receiving partial information. "Atomic" replication of unrelated properties is expensive.
Yeah that's fair. My initial instict was as-you-get-them one-by-one, even if sent and received together for a single frame. But applied all at once does make the inter-dependencies easier. I'm obviously going to make my own choices but it can be useful to hedge my bets looking at what people who have spent years on things have decided - can be interesting to discover what future problems they've already hit 🙂
Though the original question wrt how Unreal does it remains. I know that properties set in the one frame will have their final state for that frame all bundled together and sent to the client (though not every actor will, depending on relevancy, and network priority etc)
Series of posts about netcode
fwiw at least the old replication system seems to delay executing repnotifies until after received properties have been applied. Looks like it is per-object, though, so it makes no guarantees about one object having things applied before another.
Cool, thanks - I definitely remember no object-object sync, which makes sense. I'm curious how the 'new' replication works - the last big change I remember was the switch to push-based where you wouldn't have a sweep over all objects to check for changes, since that was eating CPU (probably for Fortnite). Will have a sniff around
Awesome, thanks!
so im doing a mario style jump in my online game, where when you let off the jump the gravity increases and also once you reach the apex
but to my knowledge you cant use timelines online
so im wondering if anyone knows a way to go about this
the server character behaves as expected but the clients are all jumping as if they were on the moon
Okay so im not really sure why i cant see the clothes on my player appear if i drag and drop it on the character preview
and all of this is happening as it should ive been placing breakpoints through all the code and it ends up where it should right here :
Although nothing is equipping / shows on the character, Appears to Only happen on the server cause when i do go as standalone or Listen Server it works as it should
If you're setting the mesh only on the server, that probably isn't replicated. Use a RepNotify property that contains the mesh that should be equipped. When you set the mesh on the server, set the property to the mesh as well, and then in the OnRep set the mesh like you're doing on the server.
The thing is if i double click the item, it works as it should even if im playing as client etc. The only thing thats different when dragging is when i start dragging a item i remove it from the items array cause i have implemented a spatial / jigsaw inventory or what you call it
it appears to be the problem. Cause if i a remove that while dragging it works
but i dont see why that would be a big issue, If the item isnt in the inventory but the setskeletalmesh executes why would that even matter?
When I interact with an actor, a widget with actor-related data will open, but when I interact with the client, the widget opens only on the server. Can you please help? I create the widget from actor.
So I've been following this inventory tutorial but the way it handles object destruction doesn't work for me, only the server player can do it, not the client: https://youtu.be/4bXYl11sFew?si=GCt-_XW3BnSrCJPZ
We are revisiting one of my first series on the channel; the inventory system series, this time with different implementations, improvements, and now in Unreal Engine 5.
In Part 4 we handle item interaction and replicating this across multiplayer.
SUPPORT ME
Patreon I https://www.patreon.com/ryanlaley
Buy Me a Coffee I buymeacoffee.com/RyanLa...
Destruction of actors can only be done by the server if it is a replicated actor that was spawned by the server, including things that are replicated that are placed on the map.
If you're doing an RPC to the server to start the interaction, you'd need to call back to the client in order for the client to create the UI necessary.
yes bro i am calling RPC to the server to start the interaction. How do I understand the specific client that interacts with it? How do I respond? Do I need to create a widget within this class by returning the character reference that interacts with it?
Well, right, it's a server-spawned object that's a replicated actor
The interaction is literally an input from a player pawn -> server RPC event -> calls destroy event on the interacted actor
In the context of a replicated TArray<int>, will NetDriver submit a diff to be performed on the client instance or it sends the entire packet altogether?
No widgets do not replicate. Your interaction should likely pass in a reference to the character or player controller that is performing the interaction, then you can call an RPC back on that reference within the actor that is handling the interaction. That RPC can then do whatever you need to do to display the UI and you can pass data to the client in that RPC as well.
Are you calling the RPC on the interacted actor or on the player controller/character that the client owns?
For example:
TArray<int> is empty, then I Array.Add(1) and then Array.Add(1) again. The second time Array.Add(1) occurs, will NetDriver submit the entire TArray<int> or just the instruction 'hey clients, add 1 to the TArray<int> you have?'
so NPP went from being not dead, to dead, to being not dead again? unless there's confusing internal names for stuff. apparently the latest is mover 2.0 will use NPP
On the pawn
Put a print string immediately after the RPC and check whether it is actually running on the server or if it is running at all.
So far the string trigger isn't happening.
This RPC is in a component attached to the player pawn?
Check your logs
Nope, the player pawn itself.
Output Log I mean
I've tried setting the reference for the interactive object selected by the pawn on the server, but then the output log compalins about the client pawn not having an owning connection.
If a RPC fails to be dispatched, it will raise up a flag there