#multiplayer
1 messages · Page 75 of 1
appear to be trace collisions
if i dont hit anything it looks fine. theres no red or green boxes anywhere but where the sword was
must just be buggy
perhaps it's creating points where gore and splash would end up
possibly yeah
I'm trying to make start game system
I join the game but the other players dont
hey so im having trouble getting steam sessions to work for me.
can anyone help me.
i have the project set up to the point where it was working fine when i hosted a game on my laptop, and joined it from a desktop on the same network.
and it works just fine. but when i enabled steam sessions and added the script to the DefaultEngine.ini.
i cant host anymore. it fails every time.
its set to SteamDevAppId=480 and i saw what i assume was onouther person testing there game when i search for sessions, but im unable to host
Do you have steamsockets enabled?
Ah, nvm
Steamsockets caused a error for me in hosting too
yeh it didnt work for me ether
Hello, im working on a small project to learn multiplayer and replications and im getting this error
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor interact_door_C_0. Function OpenDoor-Server will not be processed.
what does this exactly mean?
It means that you're trying to send an RPC on an actor the client doesn't own.
You can't just add an rpc function to any random actor and then call it from the client.
You have to use client-owned actors (PC, PS, Pawn)
So you might add an "Interact" method to your PC which takes an actor as its parameter. When you interact with the door, you call that method on your PC and pass the door as the parameter.
Then on the server you can deal with what you want to do with that.
Either process it directly in the PC or pass it back to teh door to handle it itself.
which plugin does work for 5.1 for steam ?
most of the plugins i have work for old versions of unreal and ill have to downgrade the project which is a pain and time consuming even doing C++ in 5.1 to make the multiplayer features that i have
so if someone know any plugin that works for 5.1 that would be helpful thanks
I'm pretty sure you can try and recompile at least some of them
It usually involves just dragging your plugin folder onto a separate compiler executable located somewhere within the engine's folder
If Epics didn't delete or change something a plugin was using, it should be all you need
You can look this process up on YT or something
I use advanced sessions, https://vreue4.com/advanced-sessions-binaries
does it work for 5.1 ?
yes
cuz i just searched around and found out multiplayer on 5.1 is broken and its up to epic to fix that
or do some C++
Broken in what way?
idk really but i remember i tried it many time before i thought the issue with my BP build that wasted a lot of money on plugins
will give what you sent a try cornholio
thanks
when we call ForceNetUpdate it wont send any property if they are not different with last snapshot right ?
It doesn't even force anything.
yea just changes the timestamp
because there is ForcePropertyCompare() and I dont know how diffrent they are
🤔
is it possible to override something somewhere (ideally without getting into the engine code) to replicate variables of a pure C++ class? 🤔 I remember someone showed me once how he replicated UObjects by doing something with UPROPERTYies so I wonder if it's theoretically possible to go further and replicate a pure C++ class that has nothing to do with unreal
The only thing I could imagine is turning it into bytes and sending those
So basically serializing it
But it's questionable why that would be needed
It's better to wrap your stuff with unreal classes
Why do you need it to be vanilla c++?
because i've sold my soul to devil
but he tricked me
without going into details lets just imagine for a second that i have a friend who works on that project where they put an old game source code into unreal and sorta emulating old game with projecting old code entities into unreal entities only when it is absolutely necessary
Factor out the data into a struct?
Is that friend you? :D
I think you're going to have an easier time converting things into UE compatible types.
That said, I am 100% in favor of using vanilla classes whenever possible.
And only using UE types for interacting with the engineer or BP or networking.
yeah well the problem that there are at least dozens of these original code entities that have some data that should be replicated. and in UE way there's no 1 to 1 projection where each property my friend wants to be replicated should go. anyway, currently my friend just examining different options what could be done here
My 2 cents: Code it in Unreal or let it be
Everything in between is just crap
You gonna run into more and more issues
i know
it's just complicated. my man doesn't call the shots regarding what architecture should the game have
and which direction the development should follow
Fighting the tools you have results in tears, in my experience.
https://gyazo.com/945ddd36f1dfaec3312f94695e2cdf30
in this case how would i target on the set cursor if i want the "owner" of the actor, since it multiplayer ?
Also I have experience in this. We switched engines half way through the project to ue4. Was a nightmare. But the game was incredibly successful by some metric.
the original code i'm working with is about 20 years old...
If you really don't want to change it, I think you'll need a migration layer in order to do engine things.
I mean... you could do custom struct serialization but you're going to be losing out on basically every feature of unreal's replication.
aside from just using it as a data channel
Marshalling, not migration.
How long would it take to rewrite it all?
Have chatgpt do it for you.
idk, network classes in original code have 15k lines of code on average and there are about 6 of them (at least AFAIK now). I've tried putting something around 1k lines of code into chatGPT and it suffocated. anyway currently i'm just playing around with ideas. it's not like I've made a decision that I'm gonna boot replication for plain cpp classes and there's no other way around. as for marshalling layer - it's something we already doing but as far as I see it now every piece of logic that should be replicated should be handled sorta manually with creating extra variables for each replicated variable and the scale of what are we gonna have this way makes me anxious
so this is why i thought hey maybe I can ask my good'ol buddy unreal if I could just somehow put his UPROPERTYies on the variables that I need to replicate and tickle some of his virtual functions somewhere in UNetDriver or data channels
If the other code is old, write it again
You can probably even throw away 10k of those 15k lines cause UE gives you so much out of the box.
I don't see any gain here using 20 years old code
It's not at all a time safe :D
i'm 100% agree with you, but again, such development direction is not my idea. I'm not fan of breaking NDAs and getting into the laundry of one's current workspace publicly, but there are some, though arguable, but non-subjective reasons the project is currently having this direction. I don't like it nor do I agree with it but there's not much I can do with it
:D Leave them behind and take on a more sane project
Jokes aside, there aren't many options
Anyone have tips when it comes to audio replication?
I'd like people to share the same song in the same area (say a nightclub) but am guessing even low pings will cause problems.
Would love suggestions or keywords to google on how to handle this.
There are a variety of "levels" in terms of difficulty with this.
The simplest would be setting the Song as an OnRep and letting the Client play it until the Server sets the variable to something else.
Next step would be sending some additional info (wrapping it into struct) that indicates where the song currently is at.
One thing you could do is simply sending a Timestamp when the Server started the song
As long as the Timestamp is synced between Server and Client, you can calculate what the current playback time should be.
Most of the time that's basically half the round trip time off
For that you do need some sort of better net synced clock than what UE offers. There is a tutorial for one pinned to this channel. But not sure if that's doable in BPs (should be though?).
Wow that's awesome. Thanks for all the tips eXi! really appreciate that.
There might be more to it and you'll notice it getting more complex in the long run, but a Synced Clock and sending the Start Timestamp and the Song should already get you very far
fantastic - really appreciate the initial direction and approach
https://gyazo.com/945ddd36f1dfaec3312f94695e2cdf30
in this case how would i target on the set cursor if i want the "owner" of the actor, since it multiplayer ?
Call "IsLocallyControlled" on the result of your cast.
That will only be true for the locally, owning Player of that Character.
Well, what is "OtherActor" in that case?
If other Actor has a valid Instigator, being a Pawn/Character, then that works the same way
Put a branch in front of the AddToViewport node and use the IsLocallyControlled as the condition
ah ok ! ty
ChatGpt told me it's possible to set the Streaming Level of an actor in Blueprints, and that this would also be picked up by the replication system, but this doesn't seem to be the case.
Lesson learned, I hope.
Well the people here have led me wrong too, and they don't roleplay as a waifu for me on the long lonely nights
So nothing learned unfortunately
Anyway I was under the impression that level streaming was exclusively local action, essentially useless for replicated systems
Was hoping to hear a bit of verification on that
Cause the AI is putting ideas into my head and now I'm not sure what reality is
In my experience the sequencer does a good job of handling replication even audio. If you can tie the song into sequencer. It seems to already sync the time on the sequencers timeline
Are animation blueprints somehow not replicated?
The "entry" animation in my AnimBP has its hands down like shown in the image.
The gun is a childBP attached to the hand socket.
Issue is that when I spawn something from the end of the muzzle on the gun, it spawns in the ground, where you see the gun tip is in the image, even though my animations have the gun pointing forwards.
This works fine on the server, but not on the client.
I hope that was understandable.
But my animations replicate just fine in multiplayer.
No - AnimBP isn't replicated, 'nor should it be
Your animations are driven based on the data it reads from the character
Hmm alright, but then how should I handle this?
I don't even follow what you're trying to do
Looks like spawning something on some socket on the muzzle
In which case, when you do your shooting logic, just spawn it in there (I'm assuming you're trying to spawn effects)
If your character's animation state isn't changing - you need to find the data that they need and make sure it is being replicated
its for the rocket launcher, the rocket always spawns in the ground, even though the code says it should spawn from the muzzle thats pointing forwards. Again works on server, just not client.
I don't know your setup
You need to replicate the proper information for your animation states to be correct
I really dont understand whats wrong. The animations work in MP, so they have to be sett up correctly, no?
Here is a gif showing the issue.
https://gyazo.com/81f4c70a1faf85da0d7f6795cb1f0d1d
The animation on the client has the correct animation, but the animation on the server is wrong.
There is only one variable that drives the animation from the "entry" state to the others, and thats an enum with the players selected weapon. That variable is replicated.
You can also see in the gif that the animation is in its correct state and that state only has one animation linked to it. So I dont understand how its not working 😵💫
animation blueprints are not replicated. The information that drives them might be, but every client (and the server) runs them completely separate from each other.
If one game instance has the wrong animation then it's because whatever data you're using to drive the animation isn't being replicated correctly.
But the only value driving the animation in this case is replicated and only being set by the server. The variable is even showing the correct value when I debug it
I'm about to have a full metldown over here. Spent the last hour trying to figure out basic Unreal networking. Trying to figure out why I couldn't connect via my local IP address. The blasted port was being blocked by Avast. And it told me nothing. I disable my shields.. and suddenly Windows Defender shows me a popup asking for the private or public port options for the app. About to uninstall Avast over here.
Use Steam or EOS (or both) Sessions instead?
Going real basic, will use sessions later after I figure out how to properly integrate them. Any tips or tricks on actually using sessions? I know how the system and the nodes work just fine, I just don't know how to actually setup Steam or EOS subsystems. The boilerplate required.
Does Steam and EOS work just out of the box, or are there a bunch of setup steps required for it?
They work out of the box. But you do need to go through the process to get them working.
There are plenty of tutorials/guides.
Check the pinned messages in this channel.
hello, I have a question, recently I have implemented multiplayer with session andI was wondering if instead of using online subsystem the player could directly port forward to make the session like in the game "The long drive".
Aye. I'll go and start looking around for them. I don't intend to ask super basic questions when there are tons of resources available. I just wanted to warn folks of Avasts behavior in not telling you what its doing.
I'm fairly new to multiplayer so if I don't understand some stuff Im sorry
Why would you want to require port forwarding?
Sessions are designed to not require the user to manually port forward
I don't require it, but isn't it the only way ?
oh ok
@buoyant light : https://www.youtube.com/watch?v=09yWANtKmC8 Here is a quick one for you. Long, but very in depth..
Creating a networked multiplayer game isn't easy, but Unreal Engine's gameplay framework is designed to set you up for success. On this episode of Inside Unreal, Technical Writer Michael Prinke will cover fundamentals such as the server-client model, various features of replicated Actors, and best-practices for efficient networked games.
Announ...
perfect thank you
That video is also one of the pins, too. Don't forget to check out all of the other pinned messages here.
oh yea sorry
You good! I just wanted to make sure you also saw all those other pins.
I was under the impression that once NETDORMANCY switched off of INITIAL, it could never go back. However, I tested and this seems to work, after all is said and done, the server reports this object as INITIAL. This makes me question what INITIAL even means......Does it mean that replicated variables will only be sent when the object is Initially created on a client?
Initial Dormancy is only valid for Actors placed in a Map.
It indicates the intention that the Actor may become Awake at a later point.
It is an optimization for Actors that are placed in a level and shouldn't be considered for replication until some gameplay event occurs later on.
"placed in a Map." -- As opposed to what?
Spawned dynamically during runtime?
Ok, that's what I thought before, but I spawned this one at runtime and it's still reporting itself as Initial
It can still be set to Initial, there is nothing stopping that.
Other than if its dormancy is flushed
Which does perform a check to revert it to DormantAll if it was initially dormant during the flush
Essentially its just stopping the Actor from being part of the Replication Consider List.
Dormant Actors can still exist on both Server and Client.
They just wont be repped
Thats kind of the point.
Dormancy is to help optimize network and cpu usage (for the server)
For example, we have turrets that are placed around the map which Players can enter and use at any point.
These are set to be Initially dormant, because they may never be used, therefore we dont want them taking up time replicating when they dont have to.
When a Player enters one, it gets set to awake.
So it can do its thing.
When the Player exists, its dormant again.
APlayerController::ClientSetHUD_Implementation is getting called on my client with the right class. But BeginPlay is never getting called in my BP HUD. Any ideas? It works in standalone, but not play as client.
Did you forget to call Super:: somewhere?
Thanks, that helps alot, though I'm still missing something, I've been working in and around these dormancy systems for 5 years but something about it always eludes me, I'll try to have a more specific question next time
Dormancy and Relevancy can be hard to grasp.
aaaah, that's probably it
I'm basically just working on general Open world stuff and need some good frameworks for classic stuff like tree removal
In the past I've built forests in chunks of HISM's with a single....Initially dormant actor replicating an array of missing bytes (trees)
Cause I didn't want the replication system considering 5000 individual trees
Anyway I'll get back to it
Thats an appropriate solution.
I added a super call to the BP BeginPlay and it works now... I'm confused as it wasn't hitting a breakpoint in that BeginPlay before.
Hi, Am developing Multiplayer Shooting Game[c++] using online subsystem as Steam but i like to switch Steam to EOS Any Idea or Can i get Related tutorial Videos . Thank you
So net relevance is per player, and net dormancy is per object?
I think of Dormancy like "When can I replicate"
Relevancy is more "Who can I replicate to"
@inland isle There are a ton of pinned videos in this channel, along with many of Epic and others videos on YouTube. Definitely don't miss out on those pinned videos though.
On a side note, I am not sure it is possible to switch online subsystems at runtime, so you may want to narrow away from that if you are just trying to change the subsystem in general.
(Can someone correct me on this, I am not sure you can do a subsystem switch at runtime, the whole game needs to be packaged for either Epic or Steam...)
Thanks buddy
Dont think he is asking to switch at runtime?
Moreso, just generally how to switch over?
yes
Which should be relatively simple. They are both Session based.
Aye, I thought that is what he is asking, but I was cautioning against at runtime if that is what he meant.
@inland isle The docs unrealengine site, under programming and scripting -> online subsystems and services -> online subsystem. Documentation for both EOS and Steam are both present there and explain in detail how to use either one. You should be able to switch by swapping the configs and stuff. It will take a tad bit of tedious work.
Ok here's another question. I set an object to DORMANTALL. It's dormant, but when I walk up to it, it pops into view.
This indicates to me that even though it's dormant, either the server or the client is still running logic to determine its visibility based on distance. Server CPU is still being taxed here...
I don't want the server running checks for each player against potentially thousands of dormant objects...or am I missing something
As i said earlier, Dormant doesnt mean its not Relevant.
Its likely still Network Relevant to that Client, just not being considered for property Replication.
Ok, so even if an actor is dormant I still need to consider the cost of relevance checks.
The default behaviour for relevancy is a simple distance check.
What then, turn off replication altogether if I want it completely free? Or destroy and rebuild it later?
Relevancy checks will always be performed. The Server has to have some mechanism for understanding if an Actor needs to be on the Clients machine.
You can override relevancy.
IsNetRelevantFor
I believe its called
/**
* Checks to see if this actor is relevant for a specific network connection
*
* @param RealViewer - is the "controlling net object" associated with the client for which network relevancy is being checked (typically player controller)
* @param ViewTarget - is the Actor being used as the point of view for the RealViewer
* @param SrcLocation - is the viewing location
*
* @return bool - true if this actor is network relevant to the client associated with RealViewer
*/
virtual bool IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const;
I think that if you go that route, you would need to basically just build a better scheme that what Unreal is giving you for proximity stuff.
If you know of a way to optimize it, that override does seem useful.
ReplicationGraph is a mechanism for optimizing relevancy for Open Worlds
Ok, but then I just can't imagine how a Fortnite server can run Relevancy checks against a hundred-thousand actors for 100 players?
It doesnt
It uses RepGraph to cut down on that
Essentially breaking the map down into buckets of particular sizes
If a Player is in a particular bucket, it only does relevancy for Actors also in that bucket
Hehe. Like a larger voxel system. Very good.
Thats the default state of RepGraph, however it can be tailored however you like
I don't guess it could be optimized further via some kind of quadtree instead of just linear buckets. Not sure what the perf tradeoff would be.
Its more complicated than my simple explanation, it does use a tree structure.
It is more complicated. Looking at the docs, you can definitely tailor that thing however you want it.
Yeah so it seems like teh main point of RepGraph is to just replace the simple distance based Relevancy checks
@low helm If you want to learn more. Follow this function chain in the Source Code.
UNetDriver::ServerReplicateActors
->ServerReplicateActors_BuildConsiderList
->ServerReplicateActors_PrioritizeActors
->IsActorRelevantToConnection
->AActor::IsNetRelevantFor
Ok thanks
Thats how IsNetRelevantFor is typically managed.
Initially Dormant actors are not part of the Consider List
So therefore would not have IsNetRelevantFor called on them.
However once they are not Initially Dormant, they will still be considered.
Ooohh
So the whole thing you were saying about "Initial is only useful for placed in map" is because that's the only way to Initial Dormancy can also prevent it from being considered for NetRelevancy
becuase the clients already have the object visible to them from any distance
Yes
There is no point checking relevancy for an Actor placed in the level
Until it has something it may need to replicate
Which would be Post Initial Dormancy
Yeah which is pretty good for me because I'm mostly working on simple collectables in open world
This seems wrong though, I walked up to an INITIAL dormant object in world and it was invisible until I got inside net relevance range.
Unless the client was doing that calculation
Are you sure your checking its dormancy on the Server and not the Client?
Dormancy is only important to the Server
I didn't check it, I just started the game and it was invisible to me at distance
can anyone help me. im having trouble getting steam sessions to work for me.
i have the project set up to the point where it was working fine when i hosted a game on my laptop, and joined it from a desktop on the same network.
and it works just fine. but when i enabled steam sessions and added the script to the DefaultEngine.ini.
i cant host anymore. it fails every time.
its set to SteamDevAppId=480 and i saw what i assume was other people testing there games when i search for sessions, but im unable to host.
Does anyone know of any party system guides?
You'd need to be clearer
Party can mean during gameplay, like WoW parties. But also before even joining a server, like a Fortnite party where you queue up together
Very different
Trying to make a basic one. You click the player, click invite, it pops up on their screen and they can accept. But I'm having trouble adding them to both of those players array of party members
During game play yeah
just want something i can watch through and gets some tips / ideas on how to go about it all
I had that in my lobby system ages ago
First of all, I would make sure to use the UniqueNetId for identifying the players
Then let's assume you have a List of all Players (maybe generated from the PlayerArray of the GameState).
PlayerState is where you get the UniqueNetId (for BPs UnqueNetIdRepl) from anyway.
actually i just managed to get it to work. but yeah i think using a uniquenetid is probably a better way
Needs C++ though, but it's a pretty straight forward function.
ah right, yeah im not touching c++ yet 😛
It's just a function library function to get that value
You should consider at least adding those
on one of the first tutorials i watched, when i player joins / leaves it adds their player controller to an array. could i use that?
Either way, when you click the Widget to Invite, you can use the PlayerController (GetOwningPlayer in the Widget) to perform a ServerRPC and tell the Server you want to invite the Player. "Player" being indentified by the UniqueNetId or whatever else you are using. Fwiw just the PlayerState.
Server then sends a ClientRPC to the invited Player.
Preferably via its PlayerController
GetOwner of the PlayerState if you use that to identify
Or you find it via the NetId first
That RPC shows a UI for the Invite
thats how im currently doing it, but yeah when they die they will no longer exist
You can also pass along the Player who invites for a Name etc.
yeah ive managed to grab all their stats / name etc from the character
If the Invite is accepted, you would then need to store the Party. I assume there can be a Party Leader?
I wouldn't use the Character at all here
yeah i will be working on a party leader, ill just use bools for that
i store all my player stats on the character, not ideal i know but thats how i originally set it up, i then pass it to player state and back on death / respawn xD
rogey
So an Array of other Members that are in a Party with you
and store an array of the player controllers as the party members?
rogey
Another idea is to handle them alongside PlayerStates
I would probably go for that, but that might be a bit more advanced
I would create an Always Relevant AInfo Actor called PartyState
When a new party is created, I would spawn that PartyState
Give it the new members
And give the PlayerStates a pointer to that PartyState
i have a playerstate ref on my character, so i can just use that and keep the setup as is, but add the playerstate instead
rogey
The nice thing about the PartyState is that it's clear that you can ask it for Party relevant stuff
Who is the leader for example
yeah thats right
Can also route multicasts through it for example to notify everyone
then when they all leave, just destroy it
rogey, ill go that path, sounds like a nice clean way to handle it
Alongside the PlayerArray
Can be non-replicated if you just want that on the server
I would probably go a step further
But that is C++
Which is overriding IsNetRelevantFor on the PartyState
And only return true if the PlayerState of a Player is in the PartyState Array
That way it won't replicate for anyone else
That's a bit more advanced :P
yeah thats out of my league atm xD
that would be nice
something like that
alright, its spawning the actor, adding 2 player states to the array (although theyre showing none, which ill deal with that later.) i set a reference for the partymanager i spawn, then when i refresh the party (for each item in the partymanagers array spawn a health bar) it comes back as invalid for the party manager
EOS also has a system and interface for parties (they call them lobbies) https://dev.epicgames.com/docs/game-services/lobbies
Cheers ill have a dig around
Because c++ is the best shit ever made bruh
Pretty sure that's not during the game but rather backend related for queueing up together
Correct it's for parties, inviting people, etc
just looking at my bp_playerstate compared to the default playerstate one. In the details panel under defined property flags, my one has way less stuff and doesnt have the replicated symbol on it. Should i be using the normal one? one of the first tutorials i followed made me make a seperate one haha
What exactly do you mean
Those flags are pretty irrelevant for you
rogey
it's honestly weird they expose those to bp and then none of the actually useful meta properties
@thin stratus
https://gyazo.com/351baddde9d08f606b2f2e7f916e7f76
godmorning man sorry but question about same subject as yesterday, this is what you mean i assume, howver what would the target be for the "set cursor" i cant attach the other actor there :/
The Target is the PlayerController of the overlapping Actor
I still don't know what the OtherActor is
I assume it's your Character?
ah yes
If it's locally controlled you can call GetController and cast it to PlayerController
However, I wouldn't set the Cursor to be visible in more than one place.
You'll eventually see yourself hunting why the Cursor is showing or not showing
You should be more aware of your UI etc.
oh so should i cast to the player and use a function inside him that shows cursor ?
What I usually do is have the PlayerController figure out what should be done
Basically I have a function that I actually call on Tick. I have a custom Enum with the options for the UI Mode (cause you need to set that one too).
And I let that function figure out if it needs to Show the Cursor and set UI Mode or hide the Cursor and set Game Mode
Or InputMode is it called and the UIOnly and GameOnly
Or GameAndUI if that makes sense for your game
The Condition for Game vs UI would be something like "AreAnyMenusOpen?"
The Widget you are making visible there could be a Menu. You'd tell your PlayerController to open it and keep track of it and the rest would the happen automatically
true ill have to thik of a smarter way of doing this for sure
but im still learning the referensing and especially for multiplayer wich is annoying when u can get owner of something to reff
is there a way when starting the game to assign players to a specific value ? like player 1 = 1 player to 2 in a varaible in gameclass
You can use PostLogin in the GameMode to assign a value to a PlayerController
like so ?
oh that just increasess the value i have to assign the player alaso ofc
how would i do that hmm :/
is it possible i made it 😮 ?
That Id is meant for something else and you shouldn't modify that
I would create a custom value on my own PlayerController and set that
Alright, its making the party manager actor. its adding both player states to the array. Issues im having is, its not setting the leader. And i can access that actor to read how many players are in the array. Any pointers please?
everytime i try to use playerstates its the biggest pain in the azzzz
should this not be working? i have a reference to the playerstate_bp from my character. then im passing them through, its creating 2 in the array with "none"
Woke up while sleeping with the solution, I had "NETLOADONCLIENT" turned off, this fixed it and Initial dormancy is behaving as expected
Thanks man I learned alot
this all runs on a server event too so it shouldnt have a problem updating it
if i set a key to print string my player state ref from my character, it shows correctly too
You should only add to the Party on the Server.
Your Actor should be replicated
And the Leader variable probably too.
party manager actor is replicated. This add player to party array function is run from server
Then the update UI function won't do anything though
rogey
You should also set the PartyState on the PlayerState to RepNotify
its still not adding them to the array though, it adds 2 that return none
So you can react to it becoming valid
Replication of this stuff needs a lot of RepNotifies and a lot of EventDispatchers
To properly notify when everything is actually valid
Your PlayerCharacter already has a PlayerState variable
I would not make a second one
rogey, the first multiplayer guide i followed made me create one
ill try revert everything back to the default one
Setting it with the GetPlayerController(0) also seems wrong, since it would be the server that sets it and that would always be the same player then
You should just use the existing variable and cast that when needed
Everything else will lead to bugs
rogey, thankyou
caching this stuff is also really not needed in case someone suggests that to you
The only places where I cache something is if it's inside an object that shares the lifetime or has its lifetime managed by its outer
E.g. a Component that sits on the Character
actually, if i use the normal playerstate, i have to use c++ dont i? its not an actual blueprint
😅
when i search all folders for Playerstate it only has my BP_PlayerState, a PlayerState that is c++ class
Yeah and?
so the only way to use it as a bp is to create a bp from that class yeah?
The PlayerState variable (the native one) points to your BP_PlayerState if you set that in the GameMode
yeah but then i cant grab the variables from the BP_playerstate for some reason
if i just use the native variable
That's why you cast it to BP_PlayerState when you need it
But you don't cache that result
ah right, i did have my ref set up that way to begin with too
Yeah, just that you should not have a variable of that type in a class that already has that variable
You'll f*ck up keeping them in sync
Cause you can't even react to all the events that modify the PlayerState variable
So you might end up having a Valid PlayerStateRef on an unpossessed character where the actual PlayerState variable is null
And jokes like that
yeah got ya, that sounds like impossible to deal with xD
bang, setting them all correctly, not to just work on the refreshing
....i still hate playerstates though 😅
How does the unreal multiplayer driver determine if two connections are able to connect and play, for cross platform multiplayer? (ie. I'm packaging for PCVR and Quest, and I need to edit some BP and disable some plugins for one of them, will the net driver allow this?)
I think at its core it doesn't care at all from where you connect to where
The only thing that cares is the overlaying Subsystem
Which would kick the Client if they mismatch (the Id types to be precise)
As long as Client and Server have the same cooked assets available to them
It should be fine
You can adjust code in the Client if it doesn't affect the Server or other Clients.
man the player state seems so slow. i might even just store it all on the player then send it to the playerstate when they die xD
Not sure what you mean with slow
You do have to keep in mind that as long as you stay away from C++, you gonna have a shit time with Multiplayer
Character and Controller have an OnRep for the PlayerState in C++ which you won't have in BPs
Stuff like that makes it annoying to work with the PlayerState
yeah sometimes it comes back invalid, sometimes it working perfect no errors. im guessing its just delay between them or something, its odd
Depends on what you are doing
If it's sometimes invalid, then you are expecting 0 latency
creating an actor. Tell the player state what actor that is and adding my player state to the array. Then when i go to refresh it i grab my player state, find that actor, and go through the array
Which is never the case
The PartyState Actor and the Array of Players has to replicate
That is never instant
yeah
That's what you should have OnRep Variables for them
yeah ive set them up
And if Actors are spawned replicated and added to arrays then it can be that the Array replicates before the Actor
sometimes its not even spawning the actor though
So the Array would be of size 1 but null
Usually the OnRep calls again when that null becomes valid
or even that, if i invite a second person a good 10+ seconds after that has been set. it still come back invalid occasionally and i dont understand why
What part of that image is invalid?
that In Party variable
So LeaderPartyPlayer is invalid?
yeah only sometimes
Where is that function called?
id say it works fine 50% the time, the rest itll be a dawg
inside an actor component on my player. and i use a server event to run this function
Where does "PlayerThatWantsToInviteYou" come from?
Is that even valid before you call the RPC?
And I assume the ActorComponent is set to replicate, right?
yeah its valid. so when i left click a player, if it gets the actor, it opens an invite option, they press that. then it spawns an accept / decline on the player they were inviting, then it sends both thats characters through those functions
yeah
ive print stringed the 2 characters and theyre correct every time
i do get hit result under cursor, cast to them, then spawn the widget and pass through self and the character i just casted to
Not sure then atm. I would try to ensure the references are valid throughout the whole code
And print their names fwiw
To see what is actually going on when it fails
They shouldn't be null on the Server
yeah ive rewrote this section so many times now xD ill go over the whole lot again
How do you Open Level for all clients on server ?
You ServerTravel to it
ok ty looking at a tutorial on it now !
@fathom aspen
https://gyazo.com/e8e898d79f51a456453c500770419e26
ok so according to the turorital this should work but nothings happening on my end can u se anything wrong ?
do the "on click event" have to be to server ?
It should indeed happen on the server
and multicast ?
No
okok
A servertravel should happen on the server
Period
Up to you to choose how to perform that
😮 its Alliiiiiiiveeeee!!!!!
@thin stratus Thanks for all the help mate, appreciate it!
@fathom aspen
alright
https://gyazo.com/e66cf1e59c55f52b6cb358c2504fe16c
then can u se why this is not working :/ ?
Because widgets are not Actors, so how come they are replicated
They are not able to fire RPCs
That's Networking 101
ohhh
I would suggest you take a look at some of the pinned messages in this channel
Multiple learning resources to choose from
aye i will do that when i got time right now i just want 1 transition thats all im going to have so :/
ok so the problem is that the caster is a widget component right
hm why would this fail 😮 ?
Read the Docs that are pinned
You are asking basics
If you don't want to invest the time to read them then no one here should invest the time to answer you
The docs exist so we don't have to answer the basics every time
yeah i get that that´s not the intention but
Is there any plugin that allows dedicated servers to handoff players in a seamless manner? I want to spin up and down server level instances for different zones and players to be able to transition between zones(servers) seamlessly. As far as i can tell this is not a feature of ue4 out of the box, and wanted to check if any 3rd party solutions exist before trying to develop something myself.
Question about multiplayer. Client wants oculus quest 2 standalone game (no computer) that works multiplayer 1-4 players. What would be best way to make it work? it is escape room style game.
any tutorials there with oculus online sessions?
There was a service, but I don't recall the name. Was, as usual, shitty expensive though.
I see, i'll do some more googling then i wasn't turning up much luck it felt. Idk if we will go with them(if they are still around), but might give some insight into how to begin.
SpatialOS was the name iirc
Is it possible to do host migration seamlessly for listen servers?
Want to make a hub area with listen server (if possible) as host and switch hosts as players leave or disconnect seamlessly so it doesn't cause them to leave and then come back
When starting the game in a multiplayer game, a character selection screen is displayed to all players. When you click the relevant button on the UI, your character is configured in a specific way and you control the character. I'm trying to do something like this but I'm not sure where I should create the widgets. If you were to consider replication, how would you program such a thing?
Upon hosting the game on one machine, the other client successfully finds the session. But when I try to ClientTravel it won't do anything. Seems like the address that it is getting is correct. How do I solve that? Everything is managed with EOS matchmaking
PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute);
UE doesn't support Host Migration afaik
Hi guys I have some questions about actor relevancy.
I have some units that grow from babies to adults, that spawn very far from the main level. Players can enter doorways to teleport to colonies of these units. My problem is as follows: if I set these actors to 'always relevant' or give them an enormous net cull distance, they spawn correctly and their aging logic (timer based) works fine. However the performance cost is enormous. If I do net culling then when players teleport to colonies, they have not spawned correctly (the colony itself is a blueprint which spawns the units one by one in unoccupied cells based on a timer). I see two solutions but my road ahead is limited by my poor understanding of net culling.
- In my colony blueprint (that handles the teleportation) I could get the list of spawned units I have and loop through them, setting 'always relevant' to true for each unit. However even typing this I feel like this is wrong.
- I could use an array of custom structs to represent all my units, and when I enter/exit a hive I can spawn and destroy (respectively) my units based on my struct array, on the client that has entered the colony. However I would also need some kind of timer system based on how long since each struct is added to my array, so that I can load them all in the correct stage of development.
One question I have: if an actor spawned on server has timer based logic (eg 12 seconds after spawn, X occurs), but is not relevant to anyone due to net culling when event X happens, if a client gets within net relevancy range after event X was supposed to happen, will it see the actor as if event X has occured? E.g. does logic fire on the server even for actors not relevant to any client?
RepNotify is what you want
it sounds like you have State, but you're trying to sync it with Multicasts
when it should be a repnotify
i'm not really using multicast, i am spawning all the units on server
and setting them to replicated
But if they are not replicated, and I multicast spawn them, will they always exist regardless for all players? But if I do that I think I will still have performance issues
because its like, 1000 units but each colony is only like 50, and players only need to see the units when inside the colonies
and they are quite expensive
Can you interact with these growing things? Do they have AI, or move around, etc?
yeah they have some basic ai they swivel and bite and have a health bar
and are killable
Well. The server is still going to have issues regardless.
So how about they dont exist at all, but only as data until a client enters a colony, they get loaded up for that client, then destroyed once the client leaves
But the aging thing sounds like it should just be a single float replicated that is the server time the thing is finished growing. It replicates once only when player is looking at the hive and no more networking needed there.
Well like I said, if I make an array of structs to represent my units, is there a way I can measure the time from when I added a struct to the array?
So I can monitor the growth time, and when I load the unit, load it in the correct development stage
I would just save one single time property for when it's done growing, or maybe two depending on serialization needs. Start and End. No need to continually send the client the development progress, they should be able to infer that on their own with just those two things and some static data.
yeah but they grow all differently depending on when they are born
its not like I have 1 growth time for the whole colony, I need to link a growth time for every unit
Also could I just have an array of the actual actors, not placed in level, then spawn/destroy them based on the array
Not really following the growth issue. If you have UnitA, does it always take XMinutes for UnitA's type to grow from 0-100%?
yeah
I guess I can do get world delta seconds
from when I add
then another get world delta seconds from when I load
or get game time sry
Example:
UnitA takes 60 seconds to grow.
UnitA-1 created at server time 32 seconds
UnitA-2 created at server time 47 seconds
Current server time is 52 seconds
UnitA-1 is has been growing for 20 seconds. It is 33.33% done.
UnitA-2 has been growing for 5 seconds. It is 8.3% done
The only thing a client needs is the current server time, and the creation time passed from server. All machines should have static data that UnitA takes 60 seconds to grow. This means one single float replicated for the duration of that unit's relevancy.
That'll help some server performance with networking, and a lot of client performance as they only need to care about the thing when it's relevant. As far as general server performance though, that's tricky. Server still needs to keep the units for everything going maybe. Depending on who is viewing where. If each player is a hive, and they can all view their own hive at the same time, server has to be able to maintain all of those hives at once. Which in theory it could do at a really low tick rate while clients locally simulate most stuff visually.
You might have a point with a large number of players, i limited it to max 4
so is max 4 hives viewed at once - but hundreds possibly total in the game
In that case, you could probably serialize them all and just reload them when a player goes there. Or severely lower/disable tick rates if keeping actors in memory allows.
Hey there! Does anyone have a recommendation on what’s the best approach to calculate hitbox line trace on the server to avoid cheating? I already have a function for that, working in single player, should I just move it into a reliable rpc?
Serialize meaning just add the actors to an array? Not clued up on terminology
And yeah could look at tick rates, if no client is near then set tick rates to like 0.5
Few ways - depends on how you want to.
- Rollback a few positions and do the line trace from there - see if it should've hit on the client's side. Obviously this requires some form of rollback
- Increase size of hitbox on server temporarily, to give some kind leeway to the clients. Still want to run the linetrace from the server to side to make sure the shot itself was possible.
Sorry. 😄 In this case I meant writing it into a save file or something
Sorry, forgot to mention it’s a melee system. Do you have a recommendation on how to make that rollback?
It line traces bottom of the sword to top btw
ok will need to look into that vaguely remember doing that in unity but was years ago
will see if needed first
Is it something like adding a transform array and pushing it thru tick to rollback or does UE have anything built-in to handle that rollback
I've never done it myself (co-op FTW), but what I've seen some people say to do is to store the last few positions and then when you attack on the client, pretty much send to the server - "Hey, I hit this person, at this timestamp" and then the server looks in it's logs, simulates that scenario and okays or rejects it
All my stuff is just, "client said he hit this NPC", server - "Okay"
😅
Co-op baby!
Cheat away, idgaf
Haha gotcha
I only do a line trace from the position on the server side to see if it was reasonably possible.
I don't do any rewinding or anything like that.
So you can't just complete the map and say you hit all enemies 😅
Dang, guess dedicated servers are the way to go I guess. My wallet is feeling the pain already
Like a comparison of distance right
Are there any cheap/free virtual dedicated servers for testing?
Is it fairly simple to setup a dedicated server for unreal?
Nah - legit, I just do a line trace and if it was somewhat reasonable, then I just allow it.
I don't do a rollback or anything like that.
Okay
But again - my needs are different. I just want people to play together and have fun.
A lot of people just let client dictate what they hit if they're doing a co-op game.
I haven't tried it yet, but I think you need to build from source to work with dedicated servers
It's easy and cheating really doesn't matter a lot of the times
Yeah, my game is p2p so it shouldn’t be something complicated but at least some basic checks
I doubt it is p2p. P2P in Unreal requires custom networking 😛
Unreal is strictly a Server-Client set up
Upon hosting the game on one machine, the other client successfully recognizes that there is an existing session and gets the address. But when I try to ClientTravel it won't do anything. Seems like the address that it is getting is correct ( although it thinks that the port is 0 which I don't think is the case ). How do I solve that? Everything is managed with EOS matchmaking
PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute);
Also, the session is not showing in the dev portal although I have all the right EOS keys in the project settings and the enginedefault.ini is set correctly according to the documentation.
did you check the log file in your project folders? May give you more of a clue of what the failure is
I did, and every time that the other client tries to join it says this
seems like it is connecting, right?
are you trying to use ClientTravel to connect to a server first time?
or are you already connected and trying to switch maps
ClientTravel to connect to a server for the first time
can it be due to "ReplicationDriverClass is null! Not using ReplicationDriver."
I can't find a replication class in UE5
well I see you have "Cannot create gamesession, session already exists" in your errors
so it may be an issue with your session creation rather than the client joining
I've not use the Epic Online Sessions myself, but typically you have to make a call to the server to clear the session otherwise it'll stay active for a while before timing out in things like Steam if I remember correctly
so it may be trying to create too many sessions with the same ID
I am using the EOS subsystem without steam. And I am pretty sure that I am destroying existing sessions
Yeah haha that’s what I meant, client-server
It also shows that there were no api calls which makes no sense
Depends™️
I mean a barebones dedicated server, sure
a dedicated server for a big comlicated LiVe SeRvIcE is another matter
are you sure your function is being called then? Did you run a debugger with a breakpoint on your function?
Yes, I did. Also, the game knows to recognize if there is already a lobby and find its IP
So I'm certain that some things are running correctly behind the scenes
It's like the lobby is working but it won't see the API calls, sessions, or lobbys in the portal
and connecting won't work
hmm, I mean I'm not seeing anything myself that sticks out.
I'd maybe try and run some debugging/logging on the PreLogin I think it is of the GameMode to see if the server is getting the request to join
not sure how much the EOS interferes with that
I'm making a procedurally generated multiplayer map where the client generates their own map meshes using a seed. I'm having an issue where you can visibly see the character lagging behind as soon as it enters the a generated room and then pop back into place when it enters the starting room. The starting room is placed into the level by hand and acts as a starting point for both the server and the client. Anyone have any idea why this happens?
@thin stratushave you tried Iris yet? is it functional or buggy?
I have not
None of our current projects require multiplayer or ship late enough to allow testing Iris
👍
dope, always looked for the role on an outer Actor o.o
guys I want to run 2 instances to test my networking
I don't want to build the project
is there a button somewhere I can't find it
It depends on what you want to test
I am using sockets to connect with server I just want 2 or more clients
so you are not doing conventional Unreal's networking?
in such case boot two standalone
ah cool thanks guys
Is there any way to end up with NON replicated actors spawned at runtime yet stably named?
Like for procedural generation
As long as you can ensure the name is the same, yes
@winged badger and me give an extended explanation of the concept there
I was actually following this article and decided to separate the client and server map generation but I'm experiencing an issue where the character mesh seems to lag behind when walking on generated tiles like in this video
what engine version are you running?
5.2 preview solves an issue with SetBase at the cmc level
the fact that your character mesh lags behind when walking on a runtime spawned mesh is odd
The server and client both spawn their own "room" meshes
which is how it should be, ensure they have the same location
and that they are net addressable
I'm generating this map at runtime for both the client and server and I'm using a blueprint actor to spawn the room where I've set NetLoadOnClient to true. You've noted two points to make sure it is "Net Addressable" ie:
1. The Actor should exist in Server and Client at a map load time: A Server Actor should relate to a Client Actor.
2. The Actor should be stably named: The Server and Client Actor should have the same “path name” so that the FNetworkGUID can be generated.
- How can I relate a server actor to a client actor that is spawned separatly?
- By "path name" do you mean the name of the actor blueprint?
When adding UI to all players, I cannot use the hud class, is this correct? Since the server is not "aware" of the HUD class?
So I'll have to create the widget and add it to viewport somewhere else?
You can't create UI on the "server" if it has no players. It has no UI. The HUD class is sent to each player and is executed locally.
This event is being called from the pawn as a "Run on server" event. But its only showing up on the player who called the actions screen, not everybody
This code is in the player controller
That's the problem. Player controllers only exist on the owning client and the server, so the other clients wouldn't receive the "Run on All" command as they don't have a copy of the player controller
Then where are you supposed to execute code like this?
I want to say Gamestate. Could also potentially be playerstate.
How though? If I'm using the player state I still need to get a reference to the players HUD to access the components in the UI? Do I need to make an array of all player controllers in the gamestate, and then "for each loop" through all of them and add the elements?
That looks like a Gamestate broadcast. Or even better a non replicated component on the gamestate used only for sending kill reel RPCs to clients.
Whenever you do a RunOnServer, RunOnClient, Multicast - when writing the code, think about which machine you're currently on, executing that code.
Think about it like you're changing machines
This could be a multicast on GameState which adds the widget to the LOCAL HUD (if it exists, rules out dedicated server), wherever it is
Assuming you want a widget on every screen when this happens
Wouldn't even bother with the infrastructure personally. Put a kill reel widget on screen somewhere and in it's construct, add a Listener from the GameplayMessage system. In the RPC, just broadcast that from the gamestate or component.
That's honestly how I'd go about it. Because multiple places might care about this type of thing.
Any examples of this anywhere? No clue where to start
Dunno. Possibly. Sec, editor not open.
It's pretty much just a GameInstance or World Subsystem that broadcasts a notification. Your GameState would trigger the broadcast.
@subtle peak So I made three classes. A simple struct to pass the data in the RPC and the broadcast. A widget for listening and displaying(or printing in this case), and a GameState for multicasting.
The widget does this. This is an Async node that listens for gameplay messages on that tags channel.
Your gamestate just does this.
Think of it like a game wide dynamic multicast and delegate listener.
For reference - you can rip this straight out of Lyra
Thank you! This is very helpful! How do I get the "Listen for gameplay messages" node? Not showing up
You'll need the plugin for it. As Duroxxigar mentioned you can pull it out of Lyra if you have it.
Gotcha. Thanks guys
windows explorer also comes in a dark theme
Function is placed inside a gamemode class
Any idea why the last event is triggered first?
All of them are placed inside the player controller
Despite the fact that they aren't connected, they aren't guaranteed to come in order iirc
that thing is synchronous only server side
If you need that data to come "in order", send it in one RPC
that changes a lot about my understanding of multiplayer
thank you
and you don't need RPCs there at all
you're RPCing stuff that is normally just replicated via GameState
GameState replicating is a bit slow for example the PlayerArray
it doesn't actually replicate that, replicated player states register with local gamestate
and iirc correctly replicated variables does replicate even if the data doesn't change?
someone correct me if I'm wrong
so it's just initialized with the gamestate, ok
It's both
and it will replicate all replicated variables first time around, then on change
The GS searches for all of them
And the PS registers itself
To counter race conditions
Do you guys recommend any book/course for this kind of stuff? Most of the things I found around doesn't cover this type of logic, order of execution etc
player states by default have net priority of 1 for some reason
so they don't really replicate early if there is a lot of things to replicate
cedric has a network compendium pinned on the channel here
recently updated, if i'm not mistaken
that's cool, I checked it more than a year ago, it was/is very useful
Thanks you both for the help, just saved me a few hours of debugging and endless google searches
the only place you can really find fine details reliably by yourself is UE source code
Hey I set this up now the way you did. But can the multicast event be called from anywhere?
I am running the "ServerAddKillLog" event from the pawn that got killed. Not firing at all 😵💫
Ideally you would be calling it from when the server determines that someone was killed.
That all gets handled from the "Recieve damage" event on the pawn. Thats where I'm calling this "ServerAddKillLog" event
IE, it shouldn't be a ServerRPC. It should just be a normal event that's already ran from the server.
Making it a ServerRPC implies that a client is telling the server something died.
What does your "Receive Damage" event look like?
Its pretty large, but straight forward, check for health, determine if killed, VFX, SFX, kill notifications, stop moving and respawn
Tried that too, not even the first print string is firing 🫤
You're doing some weird stuff here. All of this code should be running on the server. Which means that there should be nothing here calling a ServerRPC. And by the looks of it, you're telling the owning client to do the kill notification? Is that what does the ServerRPC in your game state?
Have I misunderstood the meaning of this? I thought the receive damage only happened on the server?
Also not sure how you're passing the killer here. You seem to be setting a "KilledByActor" as a replicated property. Which will most certainly not be set on the client before that RPC arrives. RPCs are basically instantly sent this frame. That KilledByPointer could take several frames to replicate.
Which is why this code here should simply GetGameState->CastToMyGameState->MulticastSomeoneDeaded
SomeoneUnalived
I feel like I should write some examples for the rpcs at some point to give some better idea on when they are needed etc
Hello all,
I'm building a system for character customization, and I'm trying to figure out the proper framework to replicate this. I'm thinking there are probably a few solutions, some more naive than others - does anybody have any resources or would be willing to help me figure this out?
Basically, I would like to know how to take data made within a menu screen (like what skin I wish to use), package it somehow, and bring it with me into a multiplayer session. Can anybody help me with this?
The way I do it, and I don't care if it is right or not, I let the player select the character stuff they want, save it as a save file - then, when the client joins, if I have a save file, load it and RPC those changes to the server. The server then updates it and it will then propagate down to the other clients.
I just use UE's built in save system pretty much.
Of course - if you want your stuff locked behind some paywall and all that, you need to add in additional checks.
Yeah just look into SaveGame files
I really wish UE5 had a content starter pack with a very basic multiplayer setup. Lyra is just too big to dive in to and learn
There are some simpler ones on the marketplace
Dont trust them 🤣
For "best practices" and so on
Meh, learning is more important than best practices
just chase fast results
and learn best practices later
The problem is you're trying to think in terms of "best".
I configure the skeletal meshes of my character by reading them from the data asset with a method. Clients for multiplayer do not detect these changes. My configure method is ServerRPC. What could be the problem?
Best practices are quite simple. Don't trust the client.
There - solved it for you. How you decide to architect something is completely game dependent.
You can trust the client if you want
Sure - but it's not "best practices"
Obviously you can do w/e you want.
I trust the client quite a lot for simplicity, but mostly because it's a co-op game and idgaf
Faster development can be a best practice in its own right 🙂
You need OnReps. Stateful changes should be OnReps.
I was chatting with DevlisD yesterday about how "Distance Checks for Net Relevancy" would have huge cost in large open worlds with many actors, so RepGraph is meant to address that. But, imagining that I had a game which managed network traffic primarily through dormancy, isn't it true I could completely sidestep the cost of "Distance Checks for Net Relevancy" by turning on "Always Relevant"?
Hey! I've got one of the weirdest problems I've ever encountered IMO. Here it goes:
- UInventoryComponent
(ComponentReplicates true, Items(ItemInfo array) Replicated true) - I've also create an AItemInfo
(AInfo, Replicates true)// This Actor stores all the information about an item that must be in the inventory (Non physical) - ABaseItem
(Physical Item, OnBeginPlay -> Spawn ItemInfo Actor and sets the ItemInfo variables to what this physical Item has. Everything replicated)
The problem is, when I grab the item from the server, everything works, but from the client nothing get's added to inventory, the code is correctly executed on the server and the Item should be added (Verified with breakpoints), but the client for some reason doesn't have those ItemInfo Actors inside his inventory Array.
If anyone needs more information to help me, just ask me and I'll provide it, for now I believe that's pretty much it.
You could - but then you increase the overall burden on the net system. Because then, regardless of range, everything has to be checked, period.
Right
So an object relevant to one client would have to be relevant to them all
But it would sidestep the Net relevancy distance checks
Yup.
What do you mean by this? I am using enums to change animation states, and it don't seem to sync properly in multiplayer. Could this be the issue?
Net relevancy is specifically an optimization TO not have everything relevant.
OnRep variables = use for stateful changes, IE - color of the skin changed or a more classic example, a door being opened or not
RPC = use for one off events
I just realized that my multiplayer setup seemed broken, only because the joining player had a collision at the spawn location. The result didn't look obvious, the player joined without a pawn.
What is the proper way to bail, when the spawning of the pawn failed?
I guess I could check if the pawn is valid in AGameMode::PostLogin and leave the session in something seems off. But maybe someone has a better idea
Another question would be, where to define the spawn parameters for pawns. There I could define that the player just spawns regardless of collisions at the spawn point
Hello, can anyone possibly help me with a replication?
I want to spawn a helicopter and this should fly to a position, that works so far with the replication, however, I still have sounds and other functions that are not replicated.
I tidied up a bit. Isn't this the same as to what you were saying? GetGameState->CastToMyGameState->MulticastSomeoneDeaded ?
this is fine for my purposes for now, eventually I'd like EoS integration but yolo swaggins, nawmean. Thanks!
Pretty much. Just don't forget to pass your arguments.
With this I'm expecting the UI to just say "none" on purpose
Trying to get it to work, but again not even the print strings are firing
Does something need to be turned on in project settings for the plugin to work?
Are you seeing the BroadcastMessage print?
If no, then it's not the plugin. If yes, it might be the plugin. But you should not need any setup for this.
I would recommend putting prints at these two green arrows to see which if them run and on what machine.
I asked the oracle for clear step by steps - would you be willing to inform me if this sounds accurate?
To create a character creation system that stores player choices and replicates them in a multiplayer session using Unreal Engine, you can follow these steps:
Create a Character Customization Struct: In order to store the data related to the player's character customization, create a custom struct. The struct should contain variables for each customizable aspect, such as body type, hair style, skin color, clothing, and so on.
Create a Player Customization Save Object: Create a SaveGame object that will hold the player's customization choices. This object should include a variable with the character customization struct you created earlier.
Save the Customization Data: Once the player has made their customization choices, save the data using the SaveGame object. Use the "Save Game To Slot" function to save the data to a specified save slot. You can choose a slot name based on the user's account or another unique identifier.
Setup a Game Instance: To make sure the customization data is persistent across different levels, create a custom Game Instance class that will store the character customization data. In your custom Game Instance, add a variable of the type of your character customization struct. After loading the save data in the main menu, store the character customization data in the Game Instance.
Replicate the Customization Data: To replicate the character customization data in a multiplayer session, you should use a PlayerState or a custom GameState object. In your PlayerState or custom GameState, add a replicated variable of the type of your character customization struct. When a player joins a multiplayer session, send the customization data stored in the Game Instance to the PlayerState or custom GameState.
Apply the Customization Data: Create a function in your character class that will apply the customization data to the character model. This function should take the character customization struct as an input and modify the character's appearance accordingly. Call this function on the server whenever the character spawns, passing the customization data from the PlayerState or custom GameState.
Replicate the Character Appearance: To ensure that other players see the customized character correctly, make sure that your character's appearance components (e.g., skeletal mesh, materials) are set to replicate. In the character class, set the components to replicate using the "Set Is Replicated" function, and also use the "RepNotify" variable replication mode for any variables that affect the character's appearance. In the OnRep functions, apply the customization data again to update the character's appearance on clients.
By following these steps, you should be able to store the player's character data, load it into a multiplayer session, and replicate the character's appearance across clients.
I'm not proofreading chat gpt for you
If you don't know what you're doing, you shouldn't use it
It works after a restart of UE5 🤷🏼♂️ Thanks though!
can someone please help me come up with a blueprint so that when a player interacts with a door, they teleport to a place in the map. In a multiplayer session only they would teleport to that spot and people could follow them if they also interact with the door after.
what part do you need help with?
Please and thank you, i've been trying to figure this out for a while now and i cannot seem to get anything to work other than teleport the host and nobody else follows
i am awful with blueprints lol, so pretty much all of it
by host do you mean you're using a listen server?
i have it connected to EOS and host sessions like that i suppose
guessing i lost ya xD
Hi everybody!
Quick question with regards to GAS.
It seems like a really performant and robust framework. But it also seems like not many use it and a lot of people complain about it.
Is there any obvious reason for this? and is any other available framework that you would recommend instead of GAS?
Anyone recommend a resource as to where to get started implementing multiplayer using c++?
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
there's also a lot more of resources on the pinned comment.
New in the marketplace... if they show a high latency video and it looks good, might be tempting.
Any idea why my dedicated server runs correctly when using the launcher but doesn’t when using the shortcut?
what is NetGuidMismatch for network error?
thrown by BP game instance for handling network error
The #gameplay-ability-system channel might disagree with you there.
Generally this occurs when the Client and Server are not the same version (something has changed between them that is enough of a difference to cause issues).
The logs should tell you more.
Probably the reviews i saw are frrom people with ptsd from learning
Reviews??
If you want a highly performant multiplayer experience in UE... you go with GAS. Or you spend a ton of time writing something similar and probably nowhere near as good.
it's a way of saying, someone even said that it's probably harder to learn than the unreal engine itself
Once you have the C++ classes in your build it's actually not that hard to learn imo
Lot of it is blueprint exposed
i'm mainly looking for something
++performance
++scalability
++multiplayer ready
and I don't mind having to put a lot of time and effort first into the setup.
so gas looks like a good option
GAS is the ticket then imo
There's a bug in 5.1 with the MMC and DECs (modifier magnitude calc and damage exec calc) where they aren't working in blueprints
The question you have to ask is, is setting up gas for the first time actually shorter than making your own system? 😂
yesn't
If you spend a little money on GAS Companion then definitely
I did my own system, I have the prototype ready.
It just doesn't evolve well with new skills : (
And GSC gives some nice added functionality
Then you didn't design it very well.
indeed, not bad for a first try : (
I'm not trying to say GAS isn't good. It's great. I'm just poking fun. 🙂
but seriously, GAS is what epic themselves use for fortnite. It's not even remotely simple, and it requires changing your mental model about how you design the underlying systems for a lot of parts of the game (assuming you want to go "full " GAS), but it works very well.
my aim is something like path of exile in terms of modifiers
where there's weird modifiers affecting in different ways.
Then you def need GAS
First try? Fantastic! Just remember to learn from the experience for the next time!
And some really custom damage execution calculations
the attributes part is easy, but when adding modifiers that adapt behavior, my system slowly falls apart
iirc GAS originated from paragon so you're fine there... MOBAs lol
can't get much more crazy in terms of modifiers than a MOBA
You can definitely get to POE levels of complexity with it
thanks, i'm going to give gas a try and see what can be done
My game is basically gonna be PoE but in a Soulslike
prob going to lurk here in the incoming time
so...souls? i'm so confused xD
Soul Path of the Dark Exile?
Path of the soul
Lmao ya
More like Elden Path of Exile Ring I guess. Open world with linear dungeons and poe loot (not as MUCH tho)
2045 is probably actually a good bet lol
That's ok tbh. I'm getting acquainted with the systems while my kids get older and can eventually join in building it 🙂
So i have this section, i have checked the bool is true at the time for that player state, yet this still goes through as false, any idea why?
they used to do 100-150 years old catedral building projects, that involved multiple generations
nothing wrong on doing 100 years ARPG
we need to hold video games on higher stem (?)
i can see the bool is true in the details for that playerstate. and its still printing false :/
and its printing for the correct playerstate im looking at too
standalone, listen server, or client?
client
are you looking at the client in both cases?
if i make a local variable in that component, it works fine. im not sure why its not reading the playerstate correctly
yeah
all print strings it saying it has the correct ones
the bool is set to replicated inside the playerstate too
so that hits the false print node?
where do you see it as true?
details panel when i select that playerstate
I don't really know much about how accurate that is.
I would assume the branch is correct and ignore the other one.
what's the difference between the blue print screenshots?
the one print is on the server
there's your disprepancy
that whole line is ran from server, and the In Party? bool gets set from a server event too
you just said it was all client
so you invite a player, it adds them to a party manager actor.'s array of party members. Who has a rep notify and for each member in the array, it updates them and sets who the leader is, what party it is, and sets In Party? to true. So the second time someone gets invited, if the person is already In Party? it should add them to that party, if its false, it creates the party manager actor.
but at the moment its reading In Party? as false and keeps creating new party manager actors. instead of just adding them to the array of the one already existing
When i player presses the accept button to join a party, it runs this.
Functions should only be named "ServerFoo()" if it's an RPC, btw
I use "AuthFoo()" for functions that should only be called on the server (and assert if they aren't).
rogey will change that, first time i ever named a function as that, just wanted to know only the server runs that
you can mark BP functions as "only runs on the server"
I forget how in BP and I'm in the middle of debugging right now.
no dramas
it would be nice if your screenshots showed the name of the class they're defined in
more so just trying to solve this issue xD if i dont store it on the playerstate, and just in the component itself, it works fine
I'm having trouble keeping track of what functions lives where.
where are all these RPCs?
sorry, the 4 bottom screenshots are all in my AC_PartySystem. The top 3 are in my Party Manager Actor
and the AC_PartySystem is on my character
so it creates the party manager, sets who the leader is, and adds the players to the array, thats working well. Then the party manager has a rep notify on the array of party members, that then runs the server event to update all their player states with the info + bool
hope that makes sense, im pretty new so probably not the greatest way to set it all up
you have an onrep that calls a server RPC? why?
should they not be used for that? i use it for when if someone leaves the party, and they were the leader, it sets another random leader then that notify fires and updates everyones playerstates to who the new leader is
Where does a call to the server factor in?
Can't only the server update info in a playerstate?
you can edit your own local copy
but if you want it to be replicated to everyone, then the server has to set it
Yeah I want it replicated to everyone
I'm not understanding why you change a variable, in the onrep on the client it immediately makes a call to the server
So when a player is added / removed it just updates their playerstate so when the next person goes to invite them, it checks their playerstate and sees if they're in a party, and if so which one
As I said I'm fairly new so not sure if my work flow is way off 😅
okay
And I went to do it in playerstate so of the character dies, it retains the party
a player instigates joining?
the AC_PartySystem does, it adds them to the PartyManager actor's array of party members, which is a rep notify, that then updates the characters playerstate
can you show me the variables that make up all this information that describes who is in what party and who the leader is?
if your goal is to replicate the property and change the player state, just do it on the server
no reason to have the client request that
where does that live?
on the party manager actor
You could put it on the game state.
so when they join, it spawns that, and adds the players to the array inside that
I am running a code like this in OnRep, but the server cannot see the change in the client. Torso->SetSkeletalMesh(CharacterDefinition->TorsoMesh);
rogey, havent really touched game states yet, just thought this way would work because then there can be multiple parties for different people
is the data that's on each player state different? or they all get all the party info?
they will all get the party info
everyone that is inside the array on the party manager actor, will recieve the info to their playerstate
player state is the wrong place to put this then, you're duplicating data for no reason
put it on the game state
then you only need one copy of who is in which party
and it shows correctly in the details. its when i try to access that info, its not showing properly
but wouldnt that make it more complicated for updating them? like if 1 player loses health, it needs to tell everyone to update their hud, i just thought it would be neater in an actor with a smaller array of players to check who need updating rather than sift through every player thats on, and check if theyre in the same partys, then update their huds
probably 4-5 max per party, maybe up to 20 per game, if it can handle it
are you not replicating character health already?
so, then you don't need to do any more work over the network
but i store that info on my character, wrong i know, but i only send it to the player state and get it back on death / respawn
when a character's health changes, see if that character is in your party by checking it on the game state
store what info?
then i just package it into a struct, send it off, respawn the player, and grab it back xD but it works
yeah, seems fine for now
my main issue is, why can i not read the correct value of the bool in the playerstate?
I don't know and the way you're managing the data and moving it back and forth is really complicated.
its the server that changes it, and its the server that looks and checks it
I would simplify it first, then debug it.
yeah as i said, im very new, and trying to make stuff myself xD so the work flow is no doubt out by a mile
what does the inParty bool signify?
that they are in a party already, so that it wont spawn another party manager actor, instead, just adds them to the array
then everyone recieves the update the arrays changed, and updates their huds and adds the extra player in
you have multiple party manager actors?
there would be yes
why?
one for each unique party
why do they need to be on different actors?
not sure where im going with it yet, but say if someone wants to go into a dungeon, it will get everyone inside that party manager, and put them in the dungeon
none of this is necessary
i just thought its an easy place to store the info only relevant to that party
someone suggested it here last night
so i ran with it
make a component on the game state:
UPROPERTY()
struct FTeam
{
// leader defined to be player at index 0
TArray<APlayerController*> Members;
}
class UTeamManagerComponent
{
UPROPERTY(ReplicatedUsing)
TArray<FTeam> Teams;
}```
you'll have to add a server RPC on the player controller or player state, since clients can't call RPCs on the game state
I don't think you're saving much by only replicating relevant data to each party. This like a max of 20 pointers in arrays.
there's also no need to store a party size, you can just get MyArray.Num()
yeah the size isnt used yet
was just in there when i made it at the start
With the playerstate, even though theyre replicated. do i need the client and the server to update the info there? is that why its recieving the wrong thing?
Something to keep in mind as you're organizing code is to try and minimize duplication of state. This opens you up to bugs where you have state that disagrees with itself.
client and server to update what info where?
Im just so confused why its reading the incorrect thing from the player state.
it shoes correct in the editor details during runtime. but always prints false
- client calls PlayerController::ServerRequestJoinTeam(int32 TeamIndex)
- this calls an add function on the team manager which adds that player controller to the team at that index in the array
- the array is replicated and all clients get an OnRep telling them it was modified
I don't know why.
And it's going to be more work trying to figure it out than it would be to make it simple.
imo
rogey, ill have a go at that. thanks for the help, appreciate it
confusing tf out of myself reading over all this xD its a maze
I feel bad for not helping solve your specific issue, but in my experience, when I get overwhelmed with the complexity of my system when trying to debug, it's a sign that I need to take a step back and rewrite it to be simpler and easier to understand. Then it's easy to debug if thigns are still wrong.
it sure is, networking is NOT easy
especially if you're new to programming
yeah first project, pretty far in already, but having a crack at making my own features and sometimes it goes smooth, others, not so much haha
all part of the fun though
I'm so tired of ListenServer. Is it possible to have a system where the server player runs the server as a separate process and connects as a client?
While the code I wrote works in a casa where everyone is a client, it does not work on a listen server and I experience this very often.
other than the fact that ie allows/encourages people to wrote client code that assumes it's the server, if you're the host
mostly due to onrep not getting called?
you get used to where you need to do things different for listen server
...
this is what I have in the moment
fwiw, I think the way you're doing it is the best way
make it work for clients and THEN fix it for listen server
the other way around is worse
Hmm, you say develop it like a dedicated server and then adapt it for the listen server?
I am constantly forcing myself to write the ListenServer correctly in one go, but every time I get a code that works correctly in the case where everyone is a client 😄
I think that's the best path.
What do you think about the server running in the background in a separate process?
Can something like this be done without being felt by the user?
It could be PTSD from releasing a AAA game where the client can only do a subset of things the host could, because the team didn't know best practices for UE yet. :P
I haven't looked into it.
It doesn't seem like it would be hard to boot up a dedicated server process and then a client process.
I will keep this in my mind and try
btw why my onreps not working on listen server 😄
is this common issue
not at all
but they don't
if you need to do stuff on server and clients, call it from the onrep and call it where you change the value.
I have a data asset and onrep that changes the appearance of my character, but the server cannot see the changes in the clients.
clients can see each other correctly
I am changing variable in Server RPC
call the onrep where you change the value
by hand?
hmm, interesting
wasnt the reason we use OnRep it will be called when value changes 😄
for clients
So I did a dedicated server network profiler test and this was only ~10 minutes
There was about 5 players connected to the server
why are the values specifically the "count" values so high, 1000+ playercontrollers and holdable axes (holdable axes are what the player spawns with)
the count is not related to how many instances were in the world, IIRC it is how many times it was checked/updated
just brainstorming. if i have say an open world, then there is dungeons too, can i have only certain players on a dungeon level and the rest on the general world? or once the host goes to a new map does it pull everyone there?
I'm pretty sure being on the same server means being in the same level
rogey thanks, im guessing dedicated servers would be the only way then? and have multiple for each area
Yeah, a different server per level
ooof, sounds fun to do
Any idea why that doesnt work for the host? only clients. returns none for the hit result as the host