#multiplayer
1 messages · Page 708 of 1
Ah so you see both roles, right?
NM_DedicatedServer and NM_client
And is the character possessed at the time you invoke the RPC?
yep. im getting this printed cpp LogTemp: Warning: AMob::Internal_AddItem: IsServer: true | NetMode: 1 LogTemp: Warning: AMob::Internal_AddItem: IsServer: false | NetMode: 3
so its working.. but like.. its also not working?
what are the requirements for sending an actor over RPC?
like does the actor itself have to be marked as replicated and/or have any replicated properties?
oh cheers
Well I asked if the player is possessed to make sure that it's owned
im trying to send a different actor over rpc from server to client. the RPC is happening within the ACharacter which is owned
pretty sure the problem is that the actor im trying to replicate is.. not marked Replicates
This is a player character, right? not a NPC?
correct
oh and its not owned by me lmao
Is this from Network Compendium?
It is
i am having 0 luck right now. the client is not receiving the actor im sending through RPC. its replicated and i own it so im not sure whats going on
If it's replicated, why you're sending it through an rpc 
idk man im just trying to get it to work
trying to get it to work
That's a typical gamedev statement that should be banned
i mean im not going to pretend what im doing. ill try whatever i can to get it to work then undo everything until it stops working
i can confirm the actor exists on the client and the server so i have no idea what the deal is
A better question would be what are you trying to do?
make an inventory thing where the server adds something, then tells the client to also add it since its in a map and i cant replicate the map
Well use a FastArray
I mean I haven't done an inventory system using a TMap, but there is a workaround for replicating a TMap
How bad that is? idk
But not the coolest thing ever
i dont need the map replicated honestly. just telling the client to add/remove stuff is fine. its a map because there is equipment slots and no other reason
Well that can be done in a FastArray, and if your inventory gets big, it would be even more performant
very nice, i have never heard of this let me read some stuff on it
Hey guys. New to Unreal here. I've been following a tutorial series on making my first game and got some scuffed multiplayer going. I packaged the project and opened it on my laptop and was able to connect successfully into the host (I ran it on my desktop). Everything mostly works. I'm having some issue with some of my moving platforms which use the sequence editor. I initially had the same problem where the platforms weren't syncing up correctly but checking "Replicate playback" seemed to fix it. I did some testing and it seems like the issue is happening after one player hosts and another joins (after the menu). If I just start the playable level with a listen server and a client, it works fine. But when I start it from the menu, the client's platforms aren't synced with the host's platforms. What do you reckon could be the issue?
sooo i tried some stuff it randmly work, and player actor don't seem replicated idk how to explain it but i really messed up replication
so is the server supposed to execute Client replicated functions?
Not unless the server is also a player (listen hosts)
its a dedicated server but its definitely executing my function. its hitting the breakpoint and the netmode is dedicated server and GetWorld()->IsServer is true
What actor are you running it on
ACharacter which i possess
nou got em
For extra safe check
give me a sec to isolate the code
UFUNCTION()
void InternalAddItem(class AItem* item, FGameplayTag slot)
[
UE_LOG(LogTemp, Warning, TEXT("AMob::InternalAddItem: IsServer: %s | NetMode: %d | Mob: %s | Item: %s"), *LexToString(GetWorld()->IsServer()), (int32)GetNetMode(), *GetName(), item ? *(item->GetName()) : TEXT("No Item"));
EquipedItems.Add(slot, item);
]
UFUNCTION(Client, Reliable)
void ClientAddItem_Implementation(class AItem* item, FGameplayTag slot)
{
InternalAddItem(item, slot);
}
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, BlueprintAuthorityOnly, Category = Mob)
void EquipItem_Implementation(class AItem* item)
{
item->SetOwner(this);
item->SetHidden(true);
item->SetActorEnableCollision(false);
InternalAddItem(item, slot);
if (GetController()->IsPlayerController())
{
ClientAddItem(item, slot);
}
}```
entry point is EquipItem
Are you sure you are seeing the server role when Client RPC executes? Because you have an InternalAddItem executed on the server before that
Also are you getting a non null reference to your actor when you execute it through the RPC?
it doesnt crash in the blueprint/editor and at the breakpoint this is valid
are the role and netmode separate?
Ok I think I found your issue
i checked the callstack as well and it is coming from ClientAddItem_Implementation but the netmode is still dedicated
You are calling a SetOwner on the server
But the Pawn is client owned
So you should be doing that in the client instead
I don't think that's the case
You can try doing a GetOwner there and see it for yourself
ah ye
so i think i found out something
so im calling EquipItem in ACharacter::BeginPlay which apparently is being called before its possessed
Well probably
I think there is an event for when you're character is possessed
Or an OnRep for controller
I'm not on my UE PC so I can't check
its ok, i added a delay and its fixed that immediate issue. im now getting some better results but the item actor itself is still not being sent to me
this is the log output LogTemp: Warning: AMob::InternalAddItem: IsServer: true | NetMode: 1 | Mob: BP_CarbonMob_Humanoid_C_1 | Item: BP_TestItem_C_2 | Owner: BP_CarbonMob_Humanoid_C_1 LogTemp: Warning: AMob::InternalAddItem: IsServer: false | NetMode: 3 | Mob: BP_CarbonMob_Humanoid_C_1 | Item: No Item | Owner: Null
its like the actor is getting lost
Well it's clearly telling you your owner is null on the client
How are you setting owner now?
its null because the item is null
I haven't seen how you print that, so I can't tell
@fathom aspen
oh sorry
it does not include the ownership thing
this is all im doing ```cpp
UE_LOG(LogTemp, Warning, TEXT("AMob::InternalAddItem: IsServer: %s | NetMode: %d | Mob: %s | Item: %s | Owner: %s"), *LexToString(GetWorld()->IsServer()), (int32)GetNetMode(), *GetName(), item ? *(item->GetName()) : TEXT("Null"), item ? *(item->GetOwner()->GetName()) : TEXT("Null"));
correct
hm wait
were you saying that the owner not being the PC might be the problem? or that im not setting it client side?
You are not setting it client side
but ownership is replicated
I'm a bit confused that for the server it's saying owner isn't null
because its owned by the acharacter
it is it literally says its owned by the mob (my ACharacter derived class)
so i fixed it. i was right that ownership is networked, however it wasnt replicated before trying to use it with the RPC. i was also spawning and taking ownership inside my blueprint which was breaking stuff. removed setting the owner in blueprint fixes literally everything
Am I mistaken or does the engine serialize bools as 32 bit integers
Is it just me or is the default visual studio intellisense soo much slower in UE5 than in UE4
I think so

yeah I feel like i'm forced to migrate/use an external tool at this point if I want autocompletion
and for some reason intellisense is also not recognizing engine symbols for ue5
that could be just an install issue tho
Has intellisense ever recognized anything without VAX 
probably if you use default serialization
custom with << throws that into the 4 byte corner

where can i buy/get a dedicated server for my multiplayer game?
You can start with AWS for a safe default choice
okay thanks!
Hi I have a question regarding multiplayer: p2p, client host/lister server:
so if you are playing with your friends, you are 4 in all.
If you are client host server and your connection gets lost, your 3 friends will also leave the game right
But in p2p, anyone from the peers can host even if he is not the first host for the game?
Thanks
Unreal doesn't have P2P, only dedi server and listen server, so in any context the server will bring everyone down with it
I see thanks I think I may have not read this thoroughly.
https://dev.epicgames.com/docs/services/en-US/GameServices/P2P/index.html?sessionInvalidated=true
But regarding p2p that is the jist of it? like anyone can be a host, even if the main host is gone?
for some reason when i seamless travel from one level to another, the client screens freezes. anyone know why this is?
they do see the new level they travelled to however
hello guys how can i play animations in both clients
see when ever i pressed some key iam setting a bplayanim true in character bp and only one client can see that animation is changing and other client cant see
you have to make sure your boolean is replicated
but when i make bplayanim to true in beginplay its working in both clients and animations are working
yes it is replicated
oh you want to play anim through a function in your character bp?
no iam making bplayanim = true in character and in another actor (Bomb) iam casting character and checking its true or not if true play animation its in tick
i added replicated true in actor
so you have play animation in tick?
ya before animation start iam checking bplayanim is true or false with branch
Does your character have access to the bomb actor? then i would recommend you use RepNotify on your bPlayAnim boolean then tell your bomb to play animation in the OnRep function instead
Does someone know why my dedicated server start with ip 0.0.0.0
But I want tat it is my external ip so friends can join
i cant seem to figure out how to transfer information from one map to another when seamless travelling
Why do i have the feeling that you talk about black desert
Anyways, what you ask for is for sure against discord TOS if not even illegal by many countries itself
Not hard. At least not from a technical point of view. Get access to source files, and legal standing to do so.
Rule #5 of this Discord applies methinks. If you don't have the source code yourself, then trying to reverse engineer it, is a form of piracy.
How much difficult is it to make this game open-source?
It is illegal and as such out of scope for this server
That's kind of covered under source code. No source code, no legal right, no game.
(Also no game developer is going to help you stealing their colleague's work)
Asking how to illegally redistribute a copyrighted intellectual property as open source in a forum full of people who are actively working to create copyrighted intellectual properties seems like a fantastic and well thought out idea.
No
And frankly coming here to talk about "amoral developers" and whatnot - who do you think you're talking to here?
I want you to go to work, every single day. 8-16 hours(no joke). Three years at the minimum. And keep this loose definition of piracy after you've released a game.
Fact of the matter is, this isn't the place to discuss trying to reverse engineer someone else's code so you, and probably others, can play for free. Morals doesn't come into it. That's the rules of this server.
Alrighty then, let's ask the <@&213101288538374145>
If you have to google how to count, you have no lines of code, moron.
Talking of being able to foresee the consequences of actions... you don't seem to be able to.
yup, heavily against the rules to discuss this.
"You guys are closed-minded and amoral money seekers - oh why u being mean to me?"
:no_entry_sign: Sun#9154 was banned.
So multiplayer game dev...
(: Just a reminder that you should still not insult other users.
Yeah. I felt bad about it right after writing it. Sorry. 😄
They're saying verify the engine in the launcher
is there a way i can set a material parameter from the server and have it take affect on all clients?
No, you have to replicate the process
Is that the privilege meter?
Hello everyone,
Happy easter first of all..
Now, do we know of any multiplayer changes in UE5? I have a project that worked perfectly fine in UE4 but in UE5 when a client join a session one of the clients's character disapears! I tried with both PIE and standalone, same result.
it's a check engine light
Missing the joke, I feel.
was trying to deadpan lol
I will admit when you first posted I was like "What?" Then the coffee kicked in and my old brain was like "Clever Mod..."
😛
confused between storijng a Game Deck on gamemode vs gamestate, which is the better option?
Do you need it to replicate to clients?
yes
even the variables in game mode?
because it does give me an option to replicate the vars
Just because a variable property has that option does not mean the actor it belongs to is replicated.
hmm...they should just disable replication (the dropdown) on all classes that inhiert gamemode
You could, in theory, make a replicated game mode.
Just because their way of doing things doesn't do it, doesn't mean they should unilaterally disable replication on game modes.
nvm, don't wanna go into that
i'll move all my stuff into gamestate
I've already read this
my confusion was on whether I wanted to replicate my gamedeck in the first place
I kinda do...since I do want my clients to know how many cards are left in the deck etc
Does every player have a deck
every player has their own hand, but there's also a master deck
You don't have to replicate the deck to tell them that.
You could replicate deck-based information withotu the deck.
You can just replicate the number of cards left on the game state then
To avoid cheating.
no..what if I want to do more tomorrow? eg: show the top card that was picked from the master deck on the clients..in that case I WILL need to know what's on the deck on each client won't I
otherwise i'll have to build unnecessary abstractions to access it via gamemode
You can always tell clients as they need
.
and also do I kinda want the clients to know at all times how many elements are left in the master deck
for which replicating the var and OnRep-ping it sounds like the best soln
Your choice in the end, we're only here to give pointers ^^
consider this btw
In that case you'll wanna do it in the game state
If you don't always awnt them to know, you could set a "hidden" state of -1 or some such.
Tbh for that, I'd just have the deck on the game state, but only replicate the amount of cards left
If players need to know X cards, I'll just send as they need
and why's that? i'm assuming because it's more expensive to replicate a list of enums than an integer
but i don't think it makes that big of a diff right
Not really, no.
Premature optimization is the root of all evil ^-^
Especially in a deterministic, non-real time game.
then should be good. think i'm good with keeping this on gamestate and having it replicated
yeah its a turn based game
Fact is, if you send the whole deck, then someone could potentially cheat and read what is in the deck to gain an unfair advantage as the values would be stored in the memory of the computer.
If all you need to do is send them a count of cards left in the deck, that's a simple int being replicated. If you need to show them the top card, that'd be tied to an event call already (eg. after dealing, send an RPC to show the clients what the card was).
All depends on how competitive / if there's money involved / leaderboards etc... If you don't care if people can cheat, then yea, just replicate the whole array of cards.
you're...you're actually right
but in my case, I don't care if they know what's left in the decks, it doesn't matter (for our game)
it DOES matter that the clients don't know the hands of other clients though...and currently the hand of each player is replicated
I have a problem I have a dedicated server and it ip is 0.0.0.0 and I port forwarded the 7780 port but I can’t connect with my public ip to it
What is "presence" in terms of online subsystem? From what I read in docs it seems that this parameter is about that feature in steam when you can see what game a friend is playing and in some games you can also see what map and mode the friend is playing. Is it all what the "presence" is about?
What are the prerequisites for steamsockets to work? I can find my sessions, but i'm getting time-out when joining. On server i am getting "Warning Ignoring P2P signal from 'steamid:76xxxxx', unknown remote connection #xxx". and this is my DefaultEngine for steam;
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="/Script/SteamSockets.SteamNetSocketsNetDriver")
;+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=n
SteamAppId=n
bInitServerOnClient=true
[/Script/SteamSockets.SteamSocketsNetDriver]
NetConnectionClassName="/Script/SteamSockets.SteamSocketsNetConnection"
Kinda clueless what's happening 😦
Hello I want to use the replication networking but it seems that in order to create a server build we need to have a source compiled version of unreal engine. Does anyone have an idea of how much space it would take? I want to use UE 4.27.2. Thanks
160 GB
Is there anyway to reduce that size by removing unwanted platforms?
not really
that is by compiling just UE, not the entire solution
most of the size is debug symbols
So the only option is to download the source code and compile it with visual studio and it takes upto 160GB and we have no way to reduce its size am i correct?
yes
I've a question
If I have an event add player in my game mode where a player controller reference is added whenever a player joins, is it possible to from these references cast to the player controllers on the clients or are they separate
no
so i must have references to the characters?
clients don't have a gamemode, or playercontrollers other then their own
What do you think "cast" does?
normally, you'd use playerstates
i think i use the wrong words, i mean calling functions on the clients controller from references stored in the server
ah ill look into it, thx
Hi guys, I made a small demo, only me character on a flat surface, I run it standalone, I set it to 60fps with ‘t.maxfps 60’ in cmd. I compile the server and the client, and it seem to be cap at 30fps, that's make my player movement very slow. on the server console it said on start, "max tick rate 30" , however I tried to set t.maxfps 60 when I run it on the server does't changed anything, I have a RTX 3070ti without any trafic on the game, I'm alone... so I wonder how to fix.
sorry for my bad english I hope you understand what I mean
If you're moving slower due to tick rate, you need to change how you calculate movement!
but FPS 30 is a bit slow for game no ? or we are at the limit minimum
you mean the character speed
walkspeed
I changed the walkspeed to higher value and it's faster now. I wondering if this will cause problem on lower/higher pc config, I would like it to be the same for all players
With the Character, walk speed should be the same at every fps
Prob a dumb question but is there a simple/ easy way to quickly replicate a game?
struggling to understand how to rn
No, there is no easy way.
You need to look at some tutorials and build it from the ground up with multiplayer in mind.
Do not try to convert a single player game.
I dont know how to build with it in mind im afraid, i plan for it to be multiplayer at the start but i dont know how to replicate and i cant get my head around the tutorials
Do you know the difference between game mode, game state and game instance?
Between a dedicated server, listen server and client?
In how it relates to MP, I mean
No
These are things you need to know.
Have you done any programming before? Or asynchronous programming, like ajax stuff on web?
Only blueprint coding in ue
Go watch some tutorial videos. Idk which ones. If you have questions about the videos - simply ask.
If you're that new, do not even consider multiplayer for your first project. Make something small, anything. But make a small complete game
If you have an idea for big project, take the core of that idea, and make a small single player project around that to learn your way through the engine.
its not my first project
Force yourself to test in multiplayer only
is there an easy way to support on dedicated and listen servers and also make it work in standalone? or do you just litter netmode checks everywhere?
standalone isnt really important since i can just run a listen server instead.. noone will know
So far our stuff just works whether client or server. If you architect it right you should be able to fire up as standalone, listen, dedicated with no differences
I just have a macro that calls OnRep on listen/standalone when I dirty a property
Since I use the push model
Make macros for stuff like that, like calling a function depending on the net mode
Saves a lot of time
do blueprint RPCs take into account the actors net priority?
e.g. if im replicating a pawns animation montage , will the multicast RPC prioritize actors with higher net priority, and if not, can I add this functionality with BP, or will it need some c++
Running into a weird issue. There’s a function in the movement component that fires on client and server whenever you jump called “DoJump” I’m overriding this function and plugging on my own logic. Super weird that when I play as stand-alone or listen server the function is fired on the server. When playing as a client this function only runs on the client. Not sure why this is happening but it’s causing rubber banding issues. Any idea why this would only be running on the client and not both server and client?
I'm trying to do some modding for a game called Conan Exiles. I'm trying to pass health data to the PlayerState from the Character on the server and then replicating it so that all clients and see the health of their group members regardless of if the character itself is relevant at the moment. The variable on the PlayerState and the playerstate itself are set to replicate, although the update frequency is low. Even so, the variable is not replicating. Is there something fundimental that I'm overlooking?
The server is the one setting that value correct?
Only if they are unreliable multicasts: #multiplayer message
oh cool so they will actually be sorted by net priority if "reliable" is unchecked? thanks for the info !
Correct
ah nice. i should probably look at the push model. my main problem here is client RPCs (ie UFUNCTION(Client))
Hey everyone, brainstorming a design for my multiplayer character selection screen and would like someone to tell me how it sounds and maybe any recommendations. So I'm making a multiplayer character select screen which would be the level after players host/join the session. Once they select a character, they'd spawn as that character in a small lobby area like the areas before a battle royale starts. My reasoning for this is that they can't immediately load into the next level because as far I understand, there can't be multiple people on different levels. If this is not the case then I guess I don't need the rest. As such, I need a way to move all the players at once; once they're in the lobby area, I can prob do something like a countdown that starts once a game is hosted (like 60 seconds) or a ready check for all players so that it sends them all at once?
A function with client only replication, called on the server to be called on a client
correct what's the problem with that?
is there something you dont understand? @plucky prawn
Nothing, I'm just asking about a best practice for client functions that works on listen, dedicated and optionally standalone.
I'm currently having issues where I think for listen servers my client function is not working correctly on the server host because on onrep functions not being called
OnRep isn't called automatically on listen servers in c++ like it is in BPs
One of the replication things isn't anyway
You basically need to do value = newvalue; if (isserver) { onrepfunction() }
correct BP onreps work different
Ye I think I remember that about the bp
Thanks guys I'll try to add this to some of my code
GetWorld()->GetNetMode() != NM_DedicatedServer is what I used to do, I think.
Like many yersa go
also understand relevancy
try to read what relevancy is about
the tldr is when you need state, you want replicated variables
when you just want to send a non-state inducing event, a rpc will do
that's part of it
but there's much more to it as to what happens with rpcs or vars once u get out of relevancy and get back in
Sounds like ass honestly. I need this so I also need to learn lmao. Thanks
ping me later so i will give a proper exp walking outside now haha
OK but if you want revshare you gotta compete with @fathom aspen
hahaha
I'm trying to launch two PIE windows where one is a server and the other is a client. I've set the Net Mode as Play As Client and Number Of Players is set to 2. The same project on UE4 launches one server and one client while in UE5 two clients are launched. How do I make it work in UE5 the same as UE4?
Play As Listen Server seems to fix it. Hmm, wonder why it works differently between the different versions...
Hey, i've build UE5 from source and it seems to work fine so far, but when i try to package the game (it's just the third person template for testing) i get this message in the output log. At the end it says "The system cannot find the specified path".
It still says the packaging was successful, but i should note that when i start the game i get an error message popup (second picture). Can anybody help me with this one?
Hello Slacker Friends,
I am trying to seamless travel my player pawn with new avatar 'but level change does not remember my avatar', any solution offer?
Thanks
M
I guess u will need to Save/Store it somewhere
No, I mean after selecting my avatar when I change level during gameplay it is returning to default avatar.
Yeah im pretty sure u need to Store it somewhere...
Hello, I have a general issue with player character possessing other pawn, i.e. a flying vehicle in a multiplayer setup (4.27). Specifically, moving the vehicle pawn with unpossessed player character attached to it is causing me a lot of pain - as if the attached player character somehow blocked that movement. Are you aware of any such issues?
Currently, I'm simply trying to AddLocalOffset to vehicle pawn (via multicast event).
Look into APlayerState::CopyProperties
You probably need to save the character class there and then in one of the functions that I can't remeber it's name now(probably HandleSeamlessPlayer) to spawn that one instead of the regular one using the property from the PlayerState
HandleStartingNewPlayer or GetDefaultPawnClass
UE5 Dedicated server Error: Assertion failed: Index != INDEX_NONE
[2022.04.06-16.23.20:644][ 0]LogWindows: Error: Assertion failed: Index != INDEX_NONE [File:D:\UnrealEngine-release\Engine\Source\Runtime\Engine\Public\Animation\AttributeTypes.h] [Line: 117]
[2022.04.06-16.23.20:645][ 0]LogWindows: Error: Missing operator for attribute, type IntegerAnimationAttribute was not registered previously ------ Guys I have this problem can someone help me ? project is in C++
It looks like calling Deactivate on CharacterMovementComponent of the attached Character helps. Still lots of issues to solve, but it looks like a good direction.
i didnt know that, like u can doo a Duplicate of an Character there?
this gets called on seamless travel
so u can pass in the data from one ps to the new one
How can I leave a session? opening a level does for all clients and destroy session doesnt work?
what should i use, mirror or photon?
someone can help me with problem up ?
bro cant u give me a tip with this #multiplayer message
You are not posting the whole call stack. What you see here is engine code. Post the whole call stack so we get a better idea of what's happening
check logs ?
The crash log that you normally get when that happens
hello guys
I receive a warning in my server log, repetitive one, LogSubsurfaceProfile: Warning: Dipole model has already been upgraded to Burley. Should not reach here
it flood the console with this warning
I don't know what it mean dho
the first one is for the simple and 4W at the same time
simple and 4W separated are two different feature, if you want both chose the first one
the third is for 4 weels drive I thing ans second 2 weels
In Unreal Editor when I tried to join a game in local network I got this message and make crash unreal, If I compile the client it does't crash.. here the popup
any idea it's append in the editor and not in the client executable
i have a question; if i make a game that uses a basic multiplayer system where i connect via IP address but i want to change it to where it uses dedicated servers, how hard is that to do?
now i have new problem before i am trying to open client window my server crash on this eror
Those two things are orthogonal. You can connect to a dedicated server by ip, or not. Be warned that doing listing servers by IP is a pretty bad idea, you're going to need some nat punch through
i wouldnt want to connect by IP, it'd just be a start for basic multiplayer. but if i know that i want to use dedicated servers that the clients connect to not via IP, would that be a challenging switch?
It'll be challenging enough but people do it everyday. You're going to want to get some sort of a network subsystem implemented early but just running a dedicated server on some box somewhere and connecting by IP is fine.
That's how I test prototypes, I just have my laptop fire up the project as a server and connect from my desktop or have my buddy connect from across the country.
oh ok
Pro tip, you do not have to build a dedicated server every time you want to test it, you can just launch the project as a server from some machine that has a compiled engine
can i use something like photon? i believe they have a free plan
Probably but that would be a hell of a lot more work than just slapping steam on it.
mk
well thank you for your help, i'm a huge noob when it comes to multiplayer so i've been trying to find the best approach
Adriel are you familiar with EelDev's Steamcore and AWS stuff?
Nah I just use plain old OnlineSubsystemSteam
Less of a multiplayer question but building the client/server. Is there any way to build Server & Client back to back so I don't need to do one, then the other?
when I play as standalone or server, I have a post process volume, but the clients dont.
Im not sure whats causing it or how to fix it
Does it exist on the map or are you spawning it at runtime?
My components replicate their transform fine in the component hierarchy, but components I add in the constructor don't. Something I should have known but did not. Can anyone share a tip on how to fix?
I know I can add them on the server only and they will rep down, but is there any way to link other than that?
exists on the map
I created a blueprint weapon blueprint to equip the weapon when I run on 2 clients only first client equiping the weapon the other client dont how can I fix that?
What the most effective way to debug why a function is being called twice on the server?
I have a player stat component, which includes things like hunger, thirst etc.
My UpdateSustenance (Hunger) function checks for Authority and if it's not the server, it calls the server function, which then calls the UpdateSustenance function with Authority Role. A pretty common practice as I understand.
However, the function is called twice for some reason and I can't figure out why.
Appreciate the help.
void UCharacterStatComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION(UAnomalyCharacterStatComponent, Sustenance, COND_OwnerOnly);
}
void UCharacterStatComponent::UpdateSustenance(float Value)
{
if (GetOwnerRole() < ROLE_Authority)
{
ServerUpdateSustenance(Value);
}
else
{
Sustenance += Value;
OnUpdateSustenance.Broadcast(Sustenance);
// Here are the contents of the log. As you can see it's being called twice from ENetRole == 3, which is ROLE_Authority afaik:
// 3: Hydration 90.000000
// 3: Hydration 80.000000
UE_LOG(LogTemp, Log, TEXT("%i: Sustenance %f"), GetOwnerRole(), Sustenance);
}
}
bool UCharacterStatComponent::ServerUpdateSustenance_Validate(float Value)
{
return true;
}
void UACharacterStatComponent::ServerUpdateSustenance_Implementation(float Value)
{
if (GetOwnerRole() == ROLE_Authority)
{
UpdateSustenance(Value);
}
}
hi guys,
I had an issue when I deploying game to aws gamelift, this is error showed.
How can I fix this problem?
Error! Cannot create the fleet. Reason: Current limit of fleets of 0 have been reached..
Use case description: An error occurred (LimitExceededException) when calling the CreateFleet operation (reached max retries: 2): Current limit of fleets of 0 have been reached.
How much clients do you have? Where is UpdateSustenance being called from?
One client. From the CharacterStatComponent that's on the player character (client)
Is it because I declared a multi cast?
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnUpdateSustenance, float, Sustenance);
And you are playing on a dedicated server?(Play as client)
That has nothing to do with it. This means you are broadcasting a delegate, so all the callbacks bound to that delegate will get fired
can you like write any code for multiplayer or?
and by multiplayer i mean for the dedicated server
No, only 512 codes
Hi, where should i store a HasLoaded variable to know when a player has loaded the map and is ready to start the game? i need to wait for all players to be loaded in before the game can actually start and spawn the characters
In the PlayerState
You can do that by overriding HandleStartingNewPlayer
If I have an pawn with role_authority on the dedicated server, and it belongs to one of the clients so it has role_autonomous on that client, then role_simulated on a second client, what would GetRemoteRole return when called on server?
Would return Autonomous for the client's possessed pawn, and Simulated for the other client's pawn
Any alternative to FObjectFinder that can be used outside of a constructor
How would it differentiate the return? If I'm calling GetRemoteRole() from the server, one of the remotes is autonomous, the other is simulated
I'm not sure what you mean. You asked what it returns, it returns autonomous and simulated, because server is knowledgeable of all pawns
How does it return both? It returns a single ENetRole
Yes, correct.
Correct. But it's running on two pawn instances. On my pawn(considering I'm one client) and on the other pawn instance that I have no control over.
But if I'm running it on the server, it's not running on the clients.
You didn't answer my other question. Who calls function UpdateSustence?
Right. But the server has all pawn instances, which in your case two pawn instances.
AssetRigestry
Hi, I'm running a dedicated server on my PC. How can I find its IP so that on my other PC i can type open ip address and connect my client?
(I tried the IP from googling whats my IP but it didnt work)
I may misunderstand how UE handles replication, but if the character exists on both client and server and I'm calling it from my local client, it would be the local client calling the function.
However only the part that's run on the server should actually do anything.
I thought the server only had one instance of the pawn? Server spawns pawn, pawn gets replicated to clients. Why would the server create a separate instance of the pawn on itself for every client?
Server doesn't spawn a pawn for every client. The pawn gets spawned on the server and replicated to all clients, and that's how all clients can see all pawns in the game. Also because the server is one who spawned all pawns, then he has access to all pawns.
The server that one client machine talks to, is the same server another client talks to on his machine
You can run ipconfig in cmd.exe on your dedicated machine, then scroll up to the first few rows. Should say Ethernet adapter Ethernet: or something.
In that section, search for IPv4 address. That's the local IP address of your PC.
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/ipconfig
Then where did these two pawn instances come from? There's one pawn instance on the server, which is authority. One on the client possessing it, which is autonomous. then one on another client not possessing, which is simulated.
Thank you. However I am trying to connect over two different wifi networks so I believe I will need the public IP address for it? (Which I obtained by Googling whats my IP, but using that with Open command isn't working)
There are two pawn instances on the server. Again the server has all pawns, considering he's the one spawned them
You may need to forward ports on your dedicated machine for others to be able to connect to it, then.
Google port forwarding for the type of router / modem you have. I think the default port for UE is defined in in DefaultEngine.ini.
?? No, where are you getting a second pawn instance from? Server spawns a single pawn, pawn is replicated to Client A (who's controller possesses the pawn) and Client B (not possessing). Pawn on the server as Authority. That Pawn on Client A is AutonomousProxy. That Pawn on Client B is SimulatedProxy. The initial question being what would GetRemoteRole() return when called from the server.
You don’t need any game network to do it, you can start the server and connect via ip address, same as multiplayer been mostly done 10 years ago and still soem games does that like Minecraft or still popular old Valve games does to this day., it most simple and default to do multiplayer, because thats how internet works. But before you start up...
Thank you, I was just doing that. The port is 7777 that I have forwarded. However it still isn't working. I wonder if I need to do anything else here. All I have done is created a third person template project, built its dedicated server and client. I tested it on 127.0.0.1 and it worked however over the internet it doesn't seem to work
thanks so much I will check out immediately
Well I'm not sure it's being called only by client's version of the pawn(or the actor component to be more specific). For example if it was called from BeginPlay, then that's normal. As it would be called on both the server and the client.
You still hasn't told me what function calls UpdateSustence, so we will keep guessing
I misunderstood your question. Apologies.
void AMyGameCharacter::Jump()
{
Super::Jump();
// The following is called twice for some reason
CharacterStatComponent->UpdateSustenance(-10.0f);
}
And as far as I can tell, calling GetRemoteRole() from server will return SimulatedProxy even if one (and in my test case, the only one) of the remotes is autonomous. Which doesn't sound exactly right to me because I thought it would be reversed. I.e. if client says LocalRole == Autonomous && RemoteRole == Authority, then server should say LocalRole == Authority && RemoteRole == Autonomous
I just checked, my local IP works with client and server connected to same wifi (Open 192.168.1.38) but the public IP doesn't work on 2 different wifi
I have forwarded 7777
I always struggle with that kind of stuff myself. Could be the firewall on your machine or your router.
Fair. Thanks a lot I will look into it more.
I don't have the source code on my end now. But iirc Jump() gets called on both the server and client
If that's really the case then that explains the behavior
I see. So is my logging then just misleading me and it's actually called once on the server, and once on the client?
I thought the following code would safeguard it from getting called on the client
void UCharacterStatComponent::UpdateSustenance(float Value)
{
if (GetOwnerRole() < ROLE_Authority)
{
ServerUpdateSustenance(Value);
UE_LOG(LogTemp, Log, TEXT("Runs on Client"));
}
else
{
Sustenance += Value;
OnUpdateSustenance.Broadcast(Sustenance);
UE_LOG(LogTemp, Log, TEXT("Runs on Server"));
UE_LOG(LogTemp, Log, TEXT("%i: Sustenance %f"), GetOwnerRole(), Sustenance);
}
}
// Here are the contents of the log. As you can see it's being called twice from ENetRole == 3, which is ROLE_Authority afaik:
// 3: Hydration 90.000000
// 3: Hydration 80.000000
When I jump the above get's logged.
Well it shouldn't be any different for one client. I usually do it for more than one client and I get what I said before.
The issue now is that GetRemoteRole() is returning SimulatedProxy even though there is an AutonomousProxy
And I'm not talking one client, there's two clients.
Well you just said only one, and anyways if you still don't understand what I said, there is a video that probably explains it better:
Support the channel through donations. Crypto accepted!
PayPal: https://paypal.me/reidschannel?locale.x=en_US
Patreon: https://www.patreon.com/reidschannel
Bitcoin: 1JFwWHr4X6uAeoZadukzqKjzFBj3Qjy7Sk
Ethereum: 0x2B2Bc108F1Cc0fF899959dEF3226637787d8C3dE
Dogecoin: DNQ33YnhpWoTBokBNVkZP5ub8KTLkpyjpv
Join our community discord!
Discord: https://dis...
14:36
Well the server would still execute the else
I never said one client. One pawn being replicated to two clients.
Can you please tell me how to fetch an asset using AssetRegistry?
Did I just not word my question well or something? Because that had almost nothing to do with my question lol. It doesn't even mention RemoteRoles, which is what my question was all about.
if you call GetRemoteRole on the server it returns SimulatedProxy
and on client it returns Authority so what is the issue?
That one of the clients is an AutonomousProxy
I was hoping for a way to detect server-side if there was an autonomousproxy or not
i think only clients supposed to simulate actor updates because the server will always have authority
https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/Registry/
If I just enable the replication graph plugin without doing anything else then the server and clients are no longer able to connect to each other. Its this normal?
Hey guys, has anyone tried to implement steam API with AdvancedSessions in UE5? Were there any disruptions compared to UE4 implementation? Wondering if migrating to v5 will work out of the box or not, Nanite and Lumen are OP
It does. That's intended. I'm struggling to understand why the server calls it twice, even if Jump() is called on the server and on the client
Apologies. I just realized what you mean with that.
Got it figured out. Thanks for the help.
Guys did someone here dedicated server in ue5? I can't do it in ue4 it was easy and no errors now I get error of third person character or server error with libraries I don't understand.... if someone here made server , please DM me
https://forums.unrealengine.com/t/unreal-5-build-crash-aqprof-dll-vtuneapi-dll/513399 did someone solve this problem ?
Hello, I simply created a FPS projet, then try to build the projet then it crashes. Here is the log: Here is the first part of my error log: Log file open, 04/05/22 13:26:57 LogWindows: Failed to load ‘aqProf.dll’ (GetLastError=126) LogWindows: File ‘aqProf.dll’ does not exist LogProfilingDebugging: Loading WinPixEventRuntime.dll for PIX pr...
This log does not mention a fatal error
It looks like an incomplete log
Like I said, this does not display a fatal error
Those DLLs not loading is fairly typical and does not crash the game if they fail to load
Also why is this in #multiplayer
its a server and i am trying to run it after server start this show as fail and server will crash
this is in mp because its dedicated server for multiplayer game
u posted crash dump above....
That is literally not a crash dump
yes it is from saved->crashes and log
It’s a screenshot of the first few lines of a log file and it does not show a fatal error
Open the dump file
i posted this its not dump file ?
That’s the least useful red line I’ve ever seen
Also that’s a log file, and that doesn’t contain the callstack anyway
The dump is below it, the file with the file name ending .dmp
I feel unnecessary
o opened dump and press debug with native only it found some
eror
hm but Its weird
Go down the callstack until you find something more useful then
it should work, steam API hasn't changed
Im having an issue with my character movement component. On setting bIgnoreClientMovementErrorChecksAndCorrection and bServerAcceptClientAuthoritativePosition both to true it doesnt save when restarting the engine and reverts back to the default. This is very necessary for my project as it has very fast and snappy movement so i need my clients to handle their own movement without corrections but its annoying having to reset the tic boxes to true every single time i open the editor. Im also unsure whether it will package my game with those as true or not. Any help would be great
Hey guys anyone have a pretty good understanding of BP variable communication? Im working on a long term project and am trying to plan out the best route to building an inventory system that scales well. Iv worked on a few prototypes, but not sure what the best approach is. I want to try and minimize client server calls wherever possible as the system will eventually need to handle potentially hundreds of players simultaneously pulling and depositing into a global inventory, as well as world loot etc. If anyone could spare a few minutes to talk that would be awesome.
your problem here is your chosen tech
blueprints can't handle hundreds of players
Well eventually it will be rewritten, but i need proof of concept first
you have literally zero tools to optimize the network there
Not really an easy question to answer, but I would highly recommend maybe purchasing the Survival Game Kit V2 which is cheap (60$) and utilizes a global inventory, it also uses inventory cells and containers... It's about as advanced as an inventory system can get. I would highly recommend that as a starting point if you are serious about learning and wanting an efficient thought out inventory
as for inventory communication - its not really that complex
your server needs to replicate the inventory to players
and players can pick up, drop, or use up items - which is an RPC every time
Its more about from an approach perspective, is it better to have variables stored on Object classes that serve as hand offs, is it better to primarily run the functions through the player controller, is it better to have dedicated spawnable actor classes that contain their own function. Im fairly new to the hierarchy of UE so thats where i want to make sure im taking the right aproach
generally, a UObject for inventory item that is basically just data is an overkill
once the players put an item into their quickslot, sure
UObject is fine
but while its just, say, sitting in some chest, UObject is way too heavy for what you need
Thats what i was thinking too. Because realistically i just need the interactable to hold a variable, then the player call the object and retrieve it, send its own command to remove said amount. Its just kind of strange how the casting system works i feel like its not the most efficient way
this is where the structs come in - and use of c++
since they are generally unmanageable from blueprints
furthermore, c++ has a FFastArraySerializer, which is generally more efficient then TArrays for this kind of replication - mainly because it is capable of per item client side callback after add, change, or remove
The issue i had with structs, is they need to be constantly broken out of their container then set, so if they are not at the top of the hierarchy you need some sort of server call to actually get their updated state, and that means now 100+ people constantly calling up to a struct every time they try to transfer data
you can't send a full UObject from client to server at all
and even when you do it server to client - you have an extra few worries - first both the reference to UObject and UObject itself need to replicate before they are in any way usable, and second, to replicate UObjects you need c++
if you had, say a chest, which is a generic enough example
Zlo do you mind if i add you and maybe hit you with a few dms? Im not in a rush at all like i said its a long term project i want to make sure i do it right. And yes i will absolutely move towards c++ once alot of things are mapped out
and in it you had 50 different items
then using fastarrays, each item would have its fastarrayitem struct
which would basically contain FItemData struct (your generic data for items) and few other things specific to that container
like what slot they are in, inside that chest
then a client picking up the item 7 from that chest would just need to call
UFUNCTION(Server, Reliable) void ServerPickupItem(UInventoryContainer* TargetContainer, int32 ItemSlot);```
to make server assign it that particular item
mmm ok so you are saying is rather than just having a key:value its better to just have the item contain a struct. That way once the slot is assigned you dont actually need to iterate over the whole array of each item just the slots.
by doing ServerPickupItem(ExampleChestPointer, 7);
Thats actually so smart
Cause i was doing key lookups and filtering items one by one. But really once the slot contents are set its just a simple lookup and pickupo
then it can be further simplified
if you had FItemData with say 20 different members
you could stash those in say, a datatable
and instead of having an FItemData in FFastArrayItem structs, you put a FDataTableRowHandle there
which is just a pointer to a DataTable + FName
then clients can access the datatable on their side and resolve that item locally
How should the hierarchy be approached then just have the items be of class actor?
The ones storing the structs
Forgive me for asking stupid questions but whats the alternative?
thx
you can't afford to choke your server's CPU by having it evaluate 5000 item actors for replication
Yeah thats what i was worried about
use an example of a health potion here
FITemData has following:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly) UStaticMesh* StaticMesh;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly) FName EquippedSocketNamel
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly) FName QuickbarSocketName;
among its data
if a character puts it on a quickbar
it just spawns a staticmeshcomponent, attaches it to the character skeleton at specified socket and it just stays there
when you want to use it, you reattach it to the equippedsocket and let the animation run
Do you have a few mins to hop in a call Zlo? Dont want to take up too much of your time but im learning alot
ok
GetNetMode is only ENetMode::NM_ListenServer for the host right?
no
it can be Standalone if no net driver is running
you'll generally want to do != NM_Client
then it doesn't even matter what kind of server it is
sorry i should have clarified, im asking specifically for a listen server setup. like if i want to know if a function if being called on the server host or a client, i only have to check the netmode right? or do i also need to check the authority
net mode asks the net driver what mode its in
authority is different
while for most actors authority is server side, its just for most actors
any actor spawned on client, if you ask it for net role, it will return authority
as client does have authority over its locally spawned actors
net mode would still be NM_Client on those
oh i see, thanks for explaining that
does anyone have any idea where this could be coming from, or places to at least investigate?
[2022.04.18-03.17.01:202][ 0]LogNet: Error: Channel name is defined multiple times: Control
[2022.04.18-03.17.01:203][ 0]LogNet: Error: Channel static index is already in use: Control 0
[2022.04.18-03.17.01:203][ 0]LogNet: Error: Channel name is defined multiple times: Voice
[2022.04.18-03.17.01:203][ 0]LogNet: Error: Channel static index is already in use: Voice 1
[2022.04.18-03.17.01:203][ 0]LogNet: Error: Channel name is defined multiple times: Actor
[2022.04.18-03.17.01:204][ 0]LogNet: Error: Channel name is defined multiple times: Control
[2022.04.18-03.17.01:204][ 0]LogNet: Error: Channel static index is already in use: Control 0
[2022.04.18-03.17.01:204][ 0]LogNet: Error: Channel name is defined multiple times: Voice
[2022.04.18-03.17.01:205][ 0]LogNet: Error: Channel static index is already in use: Voice 1
[2022.04.18-03.17.01:205][ 0]LogNet: Error: Channel name is defined multiple times: Actor
this is in the log when running a dedicated server
and upon connection the server crashes
the game works find in pie with multiple clients
i am at a loss
the crash looks like this:
[2022.04.18-03.17.36:955][856]LogWindows: Error: === Critical error: ===
[2022.04.18-03.17.36:956][856]LogWindows: Error:
[2022.04.18-03.17.36:956][856]LogWindows: Error: Assertion failed: Channels[ChIndex] == nullptr [File:E:\ue5.0\Engine\Source\Runtime\Engine\Private\NetConnection.cpp] [Line: 3750]
[2022.04.18-03.17.36:958][856]LogWindows: Error: [Callstack] 0x00007ff74ad375ef InvokeServer.exe!UNetConnection::CreateChannelByName() [E:\ue5.0\Engine\Source\Runtime\Engine\Private\NetConnection.cpp:3750]
[2022.04.18-03.17.36:958][856]LogWindows: Error: [Callstack] 0x00007ff74ad89554 InvokeServer.exe!UNetDriver::AddClientConnection() [E:\ue5.0\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:5543]
[2022.04.18-03.17.36:959][856]LogWindows: Error: [Callstack] 0x00007ff745cb28e8 InvokeServer.exe!UIpNetDriver::ProcessConnectionlessPacket() [E:\ue5.0\Engine\Plugins\Online\OnlineSubsystemUtils\Source\OnlineSubsystemUtils\Private\IpNetDriver.cpp:1572]
[2022.04.18-03.17.36:959][856]LogWindows: Error: [Callstack] 0x00007ff745cdbdec InvokeServer.exe!UIpNetDriver::TickDispatch() [E:\ue5.0\Engine\Plugins\Online\OnlineSubsystemUtils\Source\OnlineSubsystemUtils\Private\IpNetDriver.cpp:1374]
[2022.04.18-03.17.36:959][856]LogWindows: Error: [Callstack] 0x00007ff74ad9812c InvokeServer.exe!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [E:\ue5.0\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:611]
i'm not explictly creating channels on the net driver
although it seems like somehow i am implicitly?
sorry for the text wall
in an onrep, I can access the playercontroller of each player right on their respective clients right?
No
PC only exists on server and owning client
Not on simulated
If you want to loop PCs you do that on server generally
Is it not possible to send UObject variables through RPCs?
Hey I have an issue with a Dedicated Server and testing.
I created a basic OpenWorld map and have packaged a dedicated server. All that is fine and it packages ok. Server fires up fine too.
The problem occurs when I try to join the server. My client locks up and crashes.
The error is :
Assertion failed: PIEInstanceID != INDEX_NONE [File:D:\UnrealEngine\5.0\UnrealEngine\Engine\Source\Runtime\Engine\Private\WorldPartition\WorldPartitionLevelStreamingDynamic.cpp] [Line: 395]
Any ideas?
if I pack my server as a deveopment server and try the connect 127.0.0.1 method through my UE4 editor I should be able to connect correct???
yes
it was working before but not now hmmmm
same. I have a very basic dedicated server setup and although it accepts the connection, the client crashes in UE5
whats your issue specifically?
If by UObject variables, you mean pointers, then it is. But the UObject has to be replicated, and be valid on the other machine for it to work.
So that means I'm required to create a struct packet if I want to pass some datamodel like information stored as UObject in the client to game server?
Since it's not replicated and doesn't entirely exist on game server
I was expecting it to be created on the game server as well, like passing a TArray<int32>. But I guess having more/other references inside the UObject would bring some problems
Pretty much. As all passing a pointer does is resolve it to a replicated object on the other side. If there's no object it'll always be null, cause all you're passing is a basic integer that points to a memeory location which is resolved into a guid when sent through network and back to a memory location on the other machine, not an actual object.
Got it, thanks
Is there any resource (other than source code) to learn more about under the hood network and replication processes? Like how do they work/implemented? Like that GUID resolution information for example
Not a clue. Listen to Jambax talk. 😄
Has anyone got a dedicated server working with World Partition and testing in PIE?
Hey! Bit of a shot in the dark here, but we're currently optimizing server performance and are using the replication graph. So far, the gains are pretty much visible right off the bat, however, we've hit a bit of a bottleneck under NET_ReplicateActors_ReplicateSingleActor -> Replicate Actor Time.
int64 UActorChannel::ReplicateActor() itself (without taking into account other functions called by it) seems to be taking a lot of time (Self took 7.4ms, 13.8ms total with other functions called). Any idea why that would be?
The actor that's bottlenecking is the player's character if it's any help. Other actors don't seem to have that problem at all, since the character takes 87% of the Replicate Actor Time
Wouldn't that be because its replicating movement and physics so it should be fairly heavy?
The CMC itself is taking 0.8ms, so it's not that
- it's not part of the 7.4ms, at least the counter doesn't seem to put it in there.
dunno if it's the profiler being funky, but it's just an additional cost on its own
Hi, I'm using a dedicated server to which clients (VR headsets Oculus Quest) connect. But what's happening is Client A can't see Client B, but Client B can see Client A. Both have the same exact client apk. I just added a cube to the VRPlayerPawn and enabled replication.
Any clue why is this happening?
@stark tree are you spawning them from the server? are they replicated?
Any suggestions for a way to tell (on the server) whether an actor has a autonomous proxy or not? Right now I just have a flag that gets set via rpc from the client if it's an autonomous proxy. I imagine there's a way to tell without relying on a client to rpc back since the server sets up the autonomous proxy.
How can I set the visibility of a component to true for all my teammates?
Like the nickname to indicate who is part of your team?
I already have the team system and I can get the team with a variable. I tried getting all the actors and comparing that variable to set the visibility just for owner but sometimes is not working
Hi guys. I have a requirement for Login/Saving Individual player data/ Inventory management etc. Is there a service that handles these things besides Playfab?
Hi, I'm new to networking in UE4. I'm trying to get the player character from a bp. I know getting controller at index 0 is a no-no. But then how do I get the player character? I'm confused 😦
you can write your own backend and use something like aws to host it
Hosting it is not an Issue but writing my own backend is a general pain. Especially for logins and such. Hence why I'd rather opt for a service
Can you give a bit more detail. How are you trying to access the character. Through what?
Let's say I have a BP_Gun and I need to get the character from there. My thinking is to get the controller and then the controlled pawn, casting it to my character. But I dunno if that's how it works with networking involved.
No necessarily, you can get the character directly. If for example you are shooting the gun via line trace. You get the the hit actor from there and cast that into the Player_Character as well. or a better more cleaner approach is to use an Interface.
But keep in mind you will need to run the line trace on the sever.
ah, that makes sense. i didn't think about casting hits/overlaps
thank you!
You don't necessarily need to call the player controller every time.
But for the future remember if you do need the player controller via the player. Just use Get Controller and cast that to Player Controller.
Remember if the item is replicated. The Overlap event is multi casted while a line trace has to be explicitly defined as Run on Server.
thank you very much for details!
The overlap event does not multicast, it just happens to usually line up because the overlaps will be triggered on server and clients.
unreal noob question here 🙂 I'm working in unreal engine 5 on a survival\crafting game and about to start getting the inventory data system setup. To make things easier for storage\saving I plan to store the inventories for containers in a dictionary (index\ struct for the inventory) and then when the players interact with the containers, it uses the index to find the records in the dictionary.
My question is would gamestate be the best location to save this in a mp game or would a (potentially) large dictionary be outside of the scope of what we should be using gamestate for?
AKA how much data is to much for storage in the gameState?
or should i keep the dictionary on gamemode and then use gamestate for the players to pull the dictionary value from gamemode via a method
@dusty cedar I'd make it sorta transaction based. Unless you want every client to always know what is inside every inventory
Hello Adriel, Thanks! Thats kind of what I was thinking. Could end up being a lot of data and wasn't sure if storing it all in gamestate would be a good idea 🙂
It is a part of the state of the game but it is not necessarily something that the clients all need to know.
Hello. I had a multiplayer related question. I ran into an issue that I will try to simplify down and explain so I can get some insight. The problem I had was with widgets for my blueprinted characters. The widgets were just a simple title for my game with some fade in over time. I constructed them in the bp for my character on event begin play. However when a 2nd client joins after the 1st, the 1st would replay the fade in from the text and would basically be displaying the viewport of the 2nd client. If I added a 3rd client, it would repeat and all clients would see what the 3rd client did.
Logically, shouldn't both widgets be linked to their own character? I fixed the issue (band-aid fix really), by moving the construction of the widget into the playercontroller. Referencing a pic from the network compendium, it seems that the controller exists on both the server and the owning client, which would kind of explain why it seemed to fix my issue. It also means that all pawns/chars broadcast to other pawns? I see a lot of tutorials that link simple stuff like health to pawns. Wouldn't it run into a similar issue where the health of a certain pawn character is duplicated into other pawns? I'm testing all of this from the pie but I also tested it a few times in an earlier packaged build and that was how I noticed the problem once I had more than 1 client connected. Anyone able to explain to me why it didn't work when the construction was on the character but worked when I moved it into the controller?
Hi, So I had the same problem when I started out with multiplayer, but basically every game instance (of either client or server) runs its own widgets, its a local thing so when you join a game for example you run your code from the pawn or controller that gets in the widget locally (so no replication).
@red salmon Yeah I understand that no replication is needed but my widgets on client 2 would overwrite widgets on client 1 if constructed from the pawn. It only worked separately when I had it on the controller. Logically shouldn't both work?
My Spectator Pawn never calls OnRep_PlayerState, does anyone know why?
This is the pic I was talking about. So if you have a widget constructed on the pawn, according to this reference, the client doesn't "own" that widget since it's all clients? Which would explain why it overwrites but I could just be reading this incorrectly.
When working with Sessions, there is a function called EndSession in the SessionInterface. Should this be called on both servers and clients, or just servers?
I have just checked my player character and it does only have a locally run event attached to a widget
Hmm I see. I did not have a local run event. Can you show me the bp real quick if possible?
This is all run under a character
Interesting. That's pretty much what I have except it's not in an event and is called on begin play. I have it set up in the controller as of now, but let me see if I can remake it real quick in the pawn again.
I think I found your problem, you see the begin play is a thing that is being ran every time a player joins. So every time someone joins it gets run on all the pawns (players) that are in the game.
You know...that sounds like it could be the problem lmao.
Well I kinda tested it rn
What is a good workaround in your opinion? If I don't have any input from the user like yours
I say the controller option is the best
Yeah it makes the most sense to have in the controller and is probably the better practice.
I'm pretty new to unreal, but if i were to do it in pawn and I didn't have any input from the user like yourself to store it in an input event, do you know of a good way to have it called only once per player?
I just tested to confirm and yeah, it's definitely the begin play
Thanks for the help so far tho. Much appreciated.
hello, can someone help me? I am encountering this issue:
Warning: ClientRestart_Implementation failed because NewPawn is null, waiting to finish restarting
That's client
Only show widget if locally controlled
That way only the local players pawn will show the widget on begin play
Yeah that was one of the workarounds I ended up figuring out. I didn't know that event begin play triggers for server and all players. I did choose to leave it in the controller for now as it seemed like the best option
No reason it wouldn't run. The server and all clients have to create the actor. So Begin Play (and any other applicable things) would run on all machines.
I know you've fixed this. But I strongly advise never letting Gameplay classes dictate widgets. Allow them to request stuff through the local AHUD class if you really need to. But 90% of UI never needs Gameplay classes to do anything else besides run their own delegates. You should be structuring your UI inside of the local AHUD class. It's a non networked class for the local player that is maintained by the PlayerController. Widgets can bind to framework delegates and handle themselves. If you ever need to change any actor besides AHUD to delete a set of widgets, you're probably structuring things wrong, as UI should just be a simple layer on top of your gameplay stuff. If you keep them separate and keep a clean API for them, you'll have a much easier time iterating on stuff and many less bugs.
I've never used the AHUD class for any of my UI. Maybe I should look into that 🤔
I was contemplating just making a subsystem for handling all UI stuff but it sounds like the AHUD class kind of already serves that purpose
HUD is the best and easiest place to manage widgets for a player
I concur, I'm surprised they don't just have a boilerplate AHUD with most of the widget stuff there
since I think everyone ends up implementing something similar
interesting. Glad I stumbled across this before reinventing the wheel
you do have to reinvent the wheel in terms of adding the widget spawning/destruct code which everyone else has to do
since it doesn't do that itself
well yeah, I was talking about creating a class (specifically subsystem) to act as the central point for handling UI
it sounds like I woulda just ended up re-creating the HUD class
It's also fantastic because all of your UI is ran through one class. This lets you easily fix memory reference issues if you have a ton of UI that aren't correctly getting collected, as some random gameplay actor isn't referencing it. And you know that anything UI related runs through it so it's not a headache to find what is creating/using UI.
would be good plugin fodder at least, though I'd do a free one if anything
The nice thing(s) about the HUD class is that it's a) attached to a controller, b) garaunteed to be created a a reasonable time, c) is an actor so it has world references etc and d) is easily accesible
Also overrideable by game modes
BeginPlay is also called when the gamestate is guaranteed to be valid
Boy, makes me feel like a fool for avoiding it all this time lol
To be fair, it's part of the gameplay framework and in ye olden days before UMG was the only real way to draw UI
Back when it was all textures and raw text and whatnot
But it's sort of been forgotten about because UMG was quite tedious to work with in CPP originally
Yeah, that's way before my time in Unreal lol.
When I started with UE, I thought it was meant to be strictly a heads up display that got automatically put on your screen, and that was it. And so I thought, "I don't like that, I'll handle it all myself."
It probably could be argued as a legacy thing but it definitely still has a good purpose
I particularly find it nice in multiplayer because it really drives the point that UI is local only. Keeps UI stuff out of networking and gameplay classes.
could you use https://docs.unrealengine.com/4.26/en-US/API/Runtime/Core/Async/Async/ to make http calls async so the game has to wait to resolve the promise before moving on?
Execute a given function asynchronously.
the built-in http functions are already async
??????
I'm not sure what's confusing about that
well right now i have to make 1 function as the call and another as the resolve of the actual request
but if i want another call to come after the first call I need to broadcast an event or do callbacks
IHttpRequest already exposes callbacks for this.
IHttpRequest::OnProcessRequestComplete + a few other events
void UServerAPIManager::AuthenticateHttpCall()
{
TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();
Request->OnProcessRequestComplete().BindUObject(this, &UServerAPIManager::OnAuthenticationResponseReceived);
//This is the url on which to process the request
Request->SetURL(ServerURL + "/auth/login");
Request->SetVerb("POST");
Request->SetHeader(TEXT("User-Agent"), TEXT("X-UnrealEngine-Agent"));
Request->SetHeader(TEXT("Content-Type"), TEXT("application/json"));
//Request->SetHeader("Authorization", Authorization.c_str());
Request->SetHeader(TEXT("Accept"), TEXT("application/json"));
Request->ProcessRequest();
}
/* Auth Http response */
void UServerAPIManager::OnAuthenticationResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
//Create a pointer to hold the json serialized data
TSharedPtr<FJsonObject> JsonObject;
//Create a reader pointer to read the json data
const TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());
//Deserialize the json data given Reader and the actual object to deserialize
if (FJsonSerializer::Deserialize(Reader, JsonObject))
{
//Get the value of the json object by field name
Token = JsonObject->GetStringField(TEXT("Token"));
//Output it to the engine
UE_LOG(LogTemp, Warning, TEXT("Token: %s"), *Token);
// Set auth token on game instance
UMaxGameInstanceSubsystem* MaxGameInstanceSubsystem = Cast<UMaxGameInstanceSubsystem>(UGameplayStatics::GetGameInstance(GetWorld()));
if(MaxGameInstanceSubsystem)
{
MaxGameInstanceSubsystem->bAuthenticated = true;
OnAuthenticationComplete.Broadcast();
}
}
}``` lots of mock code atm so ignore anything super funky
yes, that is the correct way to do things
okay so.. I need to know when thats done so I can say.. go get player data
but you already have something doing that...
is broadcast the best way to do that.. or am i missing something
you already have a function handling when it completes
I don't understand the question.
sorry.. I'm used to programming in small functions
Authenticate isn't bound to GetPlayerData
so I could reuse authenticate where ever
or get player data whenever
I don't know what that means. You don't have anything in the above code named "Authenticate" or "GetPlayerData".
The above code already runs async, with OnAuthenticationResponseReceived called on the game thread when the request completes.
sure, what im getting at is.. say In my level BP i want to call UServerAPIManagerSubsystem->AuthenticateHttpCall, then call UServerAPIManager->GetPlayerData... right now I think it just calls the second call without waiting on the response for the first correct?
That's correct.
Either bind to an event that you call when the request completes, or pass a dynamic delegate into the first function that you call when it completes.
yeah not trying to go there
I'm deciding if i need like a central hub
that knows if i finished auth at the begining of the game, or somewhere in the middle
k ill work on this for now
tackle my bigger demons later
thx
I have this error when I try to connect to a Dedicated Server running a based OpenWorld.umap (no modifications).
Assertion failed: PIEInstanceID != INDEX_NONE [File:D:\UnrealEngine\5.0\UnrealEngine\Engine\Source\Runtime\Engine\Private\WorldPartition\WorldPartitionLevelStreamingDynamic.cpp] [Line: 395]
The client crashes but the server doesn’t. On the server I just get this timeout error
[2022.04.18-11.30.29:809][540]LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 60.01, Real: 60.01, Good: 60.01, DriverTime: 84.81, Threshold: 60.00, [UNetConnection] RemoteAddr: 127.0.0.1:62957, Name: IpConnection_2147482508, Driver: GameNetDriver IpNetDriver_2147482537, IsServer: YES, PC: PlayerController_2147482504, Owner: PlayerController_2147482504, UniqueId: INVALID
[2022.04.18-11.30.29:813][540]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 60.01, Real: 60.01, Good: 60.01, DriverTime: 84.81, Threshold: 60.00, [UNetConnection] RemoteAddr: 127.0.0.1:62957, Name: IpConnection_2147482508, Driver: GameNetDriver IpNetDriver_2147482537, IsServer: YES, PC: PlayerController_2147482504, Owner: PlayerController_2147482504, UniqueId: INVALID, Driver = GameNetDriver IpNetDriver_2147482537
Previous to that it accepts the request before the client crashes. This doesn’t happen on a regular map with no World Partition active.
Any help would be greatly appreciated.```
I'm, setting some variables in a game instance through a widget, the variable is a structure which conveys many variables in one. I'm conveying two strings, of which only one is replicated, the other when printed comes as empty. both setup the same way but on not replicating, any idea?
GameInstance isn't replicated. It only exists on the instance of the game that is running.
but you see one of the values is sent over, the other one comes as empty
while both variables in that structure are set up the same
If you're running as a listen server, then the listen server itself is the server, so they'd be setting the values themselves.
Fact remains, nothing replicates from GameInstance.
it doesnt matter if it replicates
i just want both the values to be set in the gameinstance
of which one is but the other is empty, while they're set up the same way
You want the server to set the value on a client's game instance, yeah?
exactly
My UStruct parameter on a Server RPC seem to be just giving me the default value of my struct on the server. Is there additional setup I need to do to pass structs? I'm having this problem on cpp, tried with a simple struct and RPC on blueprints and I can read the custom values on the server.
one of them even works
the other isn't set
it's set through a structure
so both should be set
Are you running as a listen server or as client?
listen server
Can you show the code?
And as I just explained, a listen server is the server, so their value would be set (which is what you're seeing)
You cannot have the server set the value in a client's game instance directly. You'd have to replicate it somewhere else if you want the server to set the value - so you have to use player controller, playerstate, somewhere where you can have the server tell the client to do something... You can do it as an RPC call or as a replicated variable, but once you are running on the client (either VIA an OnRep or an RPC) then you can set the value in the Client's GameInstance.
Sure let me make it a bit more anonymous
I'm not using the InstancedStruct btw, kind of chickened out of it
Should be just like this:
void MyFunction(const FMyStruct& Struct);
void MyFunction_Implementation(const FMyStruct& Struct)
{
// Actual code
}```
USTRUCT(BlueprintType)
struct FDataNetPacket
{
GENERATED_BODY()
bool MyBool = false;
FString MyString;
TSet<FString> MySet;
};
UFUNCTION(Server, Reliable)
virtual void SendPlayerData(const FString& PlayerID, const FDataNetPacket& JoinData);
virtual void SendPlayerData_Implementation(const FString& PlayerID, const FDataNetPacket& JoinData);
I can see on the client side where SendPlayerData is being called my struct have values true, "TestCustomString", TSet<>. But on the debug point inside the SendPlayerData_Implementation struct have the values false, "", TSet<> which I believe are the default values
In fact, I had a copy constructor before and it was having the values I was setting in it. I thought I messed up something with that and removed it but I guess it's something else
Ah, good points
Only items marked as UPROPERTY() will be replicated and/or sent via RPC
Got it, thank you
Using the VRTemplate to create multiplayer using dedicated server. I am able to bring the clients (Quest headsets) together and they can see each other however they cannot move for some reason, and the cubes attached to their hands to check replication are also not being replicated. Any suggestions?
Has anyone has issues testing connection to Dedicated Server through PIE? Specifically an error of PIEInstanceID = INDEX_NONE
Is it true for multiplayer games to work i would need to make the project in C++ instead of using the blueprint-style?
You do not need C++ but you'll likely find that serious multiplayer project are going to have a lot of "oh no, tis is only in C++" tidbits
my plan was to make a game kinda like fallout 4. i installed mods in fallout 4 so i have a m82 sniper rifle to snipe ghouls from distance and i wanna make something like this myself, having a character sniping enemies but being able to have a friend join
How can i wait for all players to load before autostarting the game?
I have functionality in Event HandleNewStartingPlayer
But i want an event like BeginPlay that triggers when all players have seamlessly travelled
Got a question that might be a bit dumb. But I've been learning multiplayer development for some time, and from what I see, developing a multiplayer game needs you to know everything about replication. Like you can't have someone just working on gameplay systems or AI without being involved in multiplayer code in some way. So if you are developing a multiplayer game, everyone on the developing team needs to know how to develop for multiplayer, right? Or are there exceptions?
Yes i would recommend so, unless you want to have like one person who goes through everything to make it replicated
That's what I thought, but even then after making things replicated, when other programmers work on the same code, they'd be confused as to what's running on the server/client, and it would be a nightmare basically for both the regular and multiplayer programmer
Yes thats why all the programmers should at least know basic replication and how to replicate the systems they are responsible for 🙂
Because if you were to have that one person go through everyones code then that person would have to learn how the other peoples code works first
Good to know, thank you
some of the team can get by with basic replication knowledge only
especially ones making UI, and other local only systems
What other kinds of local systems?
minimap, fog of war for example
lots of stuff will just have already replicated objects just register with a manager object, then just run everything locally
fog of war as an example
actors that can reveal inside fow have an actor component there, it will have a ShouldRevealFOW() function in it
that will return true or false based on if the actor is local player, in local player's team or whatnot, depending on the game
those components register with fog of war manager that just reveals fow only for the actors with the component that returns true on ShouldReveal
for the entire fog of war system that is the only connection to any kind of replication
that one function
and you can write that function inside of 2 minutes
everything else can be done by someone not being familiar with replication at all
@winged badger awesome info, thank you
also, you can get by with people with limited understanding of replication implementing simpler gameplay logic
your entire team doesn't need to know how best to replicate something, just how to replicate something as instructed by a lead
Yeh I think they at least need to know the very basics of replication with the help of someone more experienced
generally, in team of 20-25 you'll want 2 or more that understand replication really well, plus few more that have at least basic understanding
life is much easier when you have a good rubber duck handy
Can i not call "ReadyToStartMatch" in blueprint?
Does anyone know of this error on the dedicated server? [2022.04.19-12.02.54:101][518]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 59.92, Real: 60.07, Good: 60.07, DriverTime: 64971.96, Threshold: 60.00, [UNetConnection] RemoteAddr: 76561198129275537:57780, Name: SteamNetConnection_2146029285, Driver: GameNetDriver SteamNetDriver_2147472482, IsServer: YES, PC: NULL, Owner: NULL, UniqueId: Steam:[unknown] [0x11000010A12E291], Driver = GameNetDriver SteamNetDriver_2147472482
its a blueprint native event
you can override it to return true if NumTravellingPlayers == 0
and the matching client log entry?
yes i overrided it but it says its not marked as BlueprintCallable when i try to drag it into the event graph
that is because you're not supposed to call it from BP
that function doesn't start the match
just returns true or false if the match can be started, and is called under the hood, in c++ gamemode
Can someone help me out here. I have an interact system that spawns an item locally for my first person character. I then need to disable collision for the interactable actor im spawning so i cant keep grabbing it while its in my hand. This all works locally, but over the network my server when spawning an actor spawns it for everyone so i then need to disable collision for everyone. So im calling an on server event to a multicast event with the collision being set to no collision with the target for each of those events being the collider i want to disable. But even though im plugging in what i want to disable into the event when i call it, it is returning an un valid actor and is not setting the collision, even though the actor, locally is valid
Any solution for this error on the dedicated server?LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection
hello, I have a silly question, I want to replicate a variable in c++ with OnRep for this I declare my variable in the following way
UPROPERTY(ReplicatedUsing = OnRep_IsGameOver, EditAnywhere, BlueprintReadWrite) bool IsGameOver;
Following this I declare my function that should be called when the variable is successfully replicated
UFUNCTION() void OnRep_IsGameOver();
but when compiling it gives me an error
Error LNK2001 external token "public: virtual void __cdecl ACCharacterBase::GetLifetimeReplicatedProps(class TArray<class FLifetimeProperty,class TSizedDefaultAllocator<32> > &)const " (?GetLifetimeReplicatedProps@ACharacterBase@@UEBAXAEAV?$TArray@VFLifetimeProperty@@V?$TSizedDefaultAllocator @$0CA@@@@@@Z) unresolved D:\Game\Intermediate\ProjectFiles\CharacterBase.gen.cpp.obj 1
I do not know what I'm doing wrong
Where does server world records what placed object was destroyed ?
which it'd use to tell newly joining clients to destroy the object on their end coz it no longer exists on server even though it was placed on the map initially at design time
I don’t think it does
Just write it yourself
Give an id number to every object, then server can report missing ids on client login
This approach is probably not advisable if the object count gets large
But it will work for a few hundred without much issue I think
How do I fix error: Steam SDK not located! Expected to be found in Engine/Source/ThirdParty/Steamworks/{SteamVersion}?
Would help to know what you did to get that
I added SteamBridge (https://github.com/trdwll/SteamBridge/tree/develop) to my project and tried to build it
Needed anything the engine doesn't do already?
@marble rune did you download the steam SDK and put it in your project folder?
that'd be from valve's dev site
I don't think there's any need for that
Hmm. I'm having a problem with replicating UObjects. The basics are that I have inventory items as UObjects. These are replicated as an array of pointers in the component. This all works fine. But I have a function on them which gets their outer and casts to the inventory component to get their owning inventory component. This seems to work fine at first replication. But after moving an object to another inventory, it still shows the old outer on the client as the previous component.
I presume that I'm basically stuck replicating an extra owner pointer, that I'll have to use to set the outer on clients?
bump
It seems replicating another pointer to the owner and renaming it on the client works. I'm not sure why, but this feels bad though and I'm wondering if this is actually the correct way.
You'll either need to simulate them locally from the last known input so the correction is as minimal as possible or have a small buffers of updates to interpolate between
What are the implications with world partitioning and runtime or replicated actors?
Does partitioning have any input at all in that system or is it just the classic Relevency approach?
Anyone know how to make second player another model? I'm trying to make 1v 1 player with gun vs player who is zombie
Just assign the 2nd player the zombie pawn
Actors that belong to a sublevel won't get replicated if the player hasn't loaded it, at least with the replication graph
Haven't checked if it's also a thing in the default replication path
what mechanism does it use then to keep track of destroyed objected that were placed/
it doesn't
I'd be surprised if it didn't
If it doesn't, in theory the client's actor should at least be marked as torn off
void ULevel::CreateReplicatedDestructionInfo(AActor* const Actor)
void UNetDriver::InitDestroyedStartupActors()
EDIT: It's handled ^
is there a way to ensure that a WorldSubsystem exists only on the server or do I have to HasAuthority everything?
sure, just implement the ShouldCreate or what is named method
Is there any difference between sending an integer or an asset with an RPC?
of course, the size
I mean, of course there would be a difference but, is it an overhead to send assets over RPCs?
thanks a lot
Like, I have a datatable of assets. I want to reduce the load on client as much as possible so I want to do the datatable ID check on server and send the asset directly to the client to play (sound cue)
But if just this minor ooptimization is going to cause an overload on network usage, I gues I can omit that
server capacity is expensive, simple decisions on clientside are less costly
Hmm
I agree on that as well
But wanted to do this since the client should be mobile phones
So should I continue sending the ID only with RPC and letting the client do the lookup on datatable?
but still, a simple map lookup might be less costly. of course you need to ensure you don't load too much into your ram, so depending on the data table size you either need to split it per level or yeah, you might need to send the asset via an RPC hmmm you should run some profiling on this^^
I see, thanks
Without thinking about server/client optimization, how does an asset being sent over network? Shouldn't it be some kind of identifier only? How much size would it differ from sending an int or int64?
Hm I'm not sure, I think initially it could be the path, so string, and then later as GUID after being acknowledged?
what am I doing wrong here? I have an actor I want to call server RPCs on, so I set the player controller to the owner on the server (via the constructor params), but when I call the server RPC on the client it's local role is still set to ROLE_SimulatedProxy and the RPC fails due to no owning connection.
"Via the constructor params", please send some code.
// in player state beginplay, behind HasAuthority() check.
FActorSpawnParameters Params;
Params.Owner = GetOwner();
AAchievementTracker= GetWorld() ? GetWorld()->SpawnActor<AAchievementTracker>(Params) : nullptr;
the owner of the player state is the player controller, no?
oh, you mean not a network owner?
yeah, would be my guess
I think you need to register it with the player controller or smth like this? never did it, lets ask the docs^^
"The Actor that spawned this Actor. (Can be left as NULL)."
So it's basically just for context, but not for network
Are you actually sending an asset or an asset reference?
I'm not sure, what's the difference? I wanted to send a sound cue
You're not sending the cue, you're just sending a ref. It's negligible (32 bits either way I think)
Can you give an example on sending the cue/asset as well for me to make it more tangible?
it does
See void ULevel::CreateReplicatedDestructionInfo(AActor* const Actor), void UNetDriver::InitDestroyedStartupActors()
Just make a sound cue ref a parameter on a replicated event
I meant more about non ref ones, I don't get the difference between them
Show a non ref sound parameter in an event.
how do i set the name when a player joins a server without a session,currently trying to connect to the dedicated server only sets my name based on my pc's name
bump
I just switched my project to UE5 and everything related to Advanced Steam Session Plugin is broken, how do I fix it please ?
Please ping me if any answer
could be missing a module include that changed name
like NetCore
I'm creating multiplayer game on gamelift, and max player count on one game session is 200. Is there any trick to increase that number?
or can client only receive data from nearest ~50 player based on player location their location?
200 players with Unreal is gonna be a problem anyway
hi, i was following chunk downloader 2 hour live training video and able to download from IIS manager but with amazon s3 link, i couldn't download or nothing is happening ? please say if anyone knows how to fix this
Has anyone been able to connect to a Dedicated Server running a World Partition map from PIE? I'm getting a PIEInstanceID=INDEX_NONE error that is crashing the client. It would be problematic to have to package the game everytime I want to test a change
Can I declare OnRep functions on child classes for replicated member variables reside in parent class without ReplicatedUsing specifier?
No, but you can do it in the parent class and make the function virtual
Any luck for engine classes with vanilla engine?
yeah, works without issues. di you run the dedicated server under the same process or on a separate one?
what do you mean?
Wait I also didn't get what you mean
I want to declare a OnRep function for APlayerState::PawnPrivate for example
@marble gazelle Im not sure as I never set anything for that. I'll check it out tho thanks
Which doesn't exist as to my knowledge
I just disabled the run under one process setting and it still does it
well no, you'd need to modify the source code for it, or look if there is some other way to achieve the same results.
In order to listen to an onrep, it needs to be declared in the class having the property. the OnRep function it self can be virtual so you can override it
I see thanks
I get this error. It's hard to find any info about it too. I can connect to a normal level, or if I package my game, but can't connect through PIE at all
well you entered the field of rare bugs, what t do now? 😄
Well, attach a debugger, check where the value is set and figure out why it has the wrong value.
hello, any ideas what could be wrong when BeginPlay for Character is not called on Client, when using Replication graph? (Actor is spawned and visible)
gamestate not replicating?
@marble gazelle looks like for now I will just use a test map without world partition, but it does connect with a packaged game so I will just substitute the map later. Sucks though. My OCD wants to fix it before I move on but it is what it is and I need to move on regardless.
how do you fix it ? Because when I disconnect the nodes from Advanced Session Plugin I can compile again but still I can't use the Advanced Sesssion plugin anymore
Use a 5.0 version of the plugin
Where to find it ?
Wherever the plugin is distributed
There's no 5.0 version
Still sort of wondering about reparenting UObjects to a new outer on clients. I managed this by replicating a pointer to the server set outer on them and renaming it in the onrep. Is this really the only way to handle this?
I mean, I could instantiate new ones for the new outer and transfer data. But that feels kinda bad. I'll keep that in mind though.
I'm using the outer as a way to reference the object's owner. Feels messy just keeping a pointer to the owner and not changing the outer.
hi, is there any system that player can send feedback back to developers ? in aws or any others
Does anyone know if fortnite uses CMC?
Where did you find it please ?
Github
is CMC as bad as everything say? is it that slow?
Link please
Seriously?
Character movement comp?
Yes
We use it for our multiplayer survival co-op game. We haven’t found it slow.
What it doesn’t do though is good smoothing, so you might get rubberbanding
If you don’t write your own smoothing
Do you wrote it? what functions do you changed?
I don't think it's "slow" but if you want to have lots of characters (hundreds/thousands) running around at once, it won't be performant. It has its uses and context
One hundred in PC is more or less fine in my experience, but test with target hardware. What can be problematic in that case is multiplayer, CMC is not designed for such numbers across the net
Depends if players are separated (like Fortnite, where you interact with few players at a time) or for example an RTS where all units can be on the screen at once.
I don't know what Fortnite uses, but given that Fortnite is built on Unreal it will be fine
Ty
CMC isn't cheap but it's still fine at 100 players
"fine"
If the features are needed them doing better is not easy i think
Anyone else noticed the new vehicle template is broken in UE5 playing as client and found a solution maybe? Around 85km/h the engine stalls and you won't go to gear 3. Everything works fine if you play in standalone
Hi, if i create a loading screen widget in the pre lobby level's player controller, how do i tear it down when the map has loaded since all the GM/PC ect have all changed to new ones? i cant seem to remove it
Hey,
I'm doing a seamless travel and copying player's properties using the playerstate and the CopyProperties Event.
Now I'm wondering, what's the best event to use to spawn the pawn AFTER CopyProperties happend, so that it is guaranteed that the properties are the ones that have been copied from the previous level?
should the PlayerState call a custom event on the GameMode and therefore notify that it should now spawn the Pawn? Or does the GameMode already have an Event when the PlayerState has been copied?
I'm curious if any one's tried building a game engine based on the documentation provided here? https://docs.unrealengine.com/5.0/en-US/setting-up-dedicated-servers-in-unreal-engine/ I've given this a try but I end up getting this error: Server targets are not currently supported from this engine distribution.
also this applies for both UE5.0 and 5.0.1
you get that message because you are using the launcher engine rather than source
More like compile it
download then compile it 🙂
The compiling is gonna be a lot longer than the downloading 😛
understood, I guess i should go read on some source building for UE5 then 😂
the clone is certainly taking a long while, but it's not as bad as downloading the entire thing via the epic launcher
Hi, nice to speak to everyone, i'm new to Discord.
Can someone tell me how to play on the DE GER servers. Lot of good maps there but everytime I try to play on one, they require a password.
it's literally 10-20 minutes building the development editor target
if you do it properly, ie. project side-by-side, building the game project only not solution/"UE4"
Yeah I do that and it's a lot more than that, not on the Ryzen train yet
my old i7 was still around 25 mins
Last UE5 build I did was 2h on an i7
same
only dev editor target tho
unless somehow further setup is required in VS, got stuck for an hour building
Hello, I have a question. I have a project that uses a dedicated server, currently all the basics of the project work very well, but I have a pawn that has a camera which the player can own and move, this pawn is not seen by the other players, so I am not replicating it , but I only get it to move when the player is a server, the clients do not move no matter how hard I try to move it. Does anyone know what I can do to make this work.
This pawn Cam
this player input
I don’t know the solution to this problem but I know what the problem is. The server always wants to handle pawn possession in multiplayer games
So the server can’t tolerate the players having their own unreplicated pawn
There might be a solution for this in the player camera manager class for the client to automatically manage their location
Or just have the pawn not have anything replicated
That still doesn’t work because you can’t possess anything on a client
Unless I misunderstand
ok, thanks for the answers, having problems with owning a pawn what if instead of owning I just change the player's camera view with set view target with blend?
This would cause problems with the servers understanding of the players camera location, specifically in regards to net relevance and cull distances
I’m pretty sure the solution for this is found in creating your own custom playercameramanager And turning on the client driven position updates
you can always attach the possessed pawn to keep relevancy somewhat close to the cam origin
🩹
I will check more, thanks for the answer
Hey guys, I'm having replication issues on a topdown click to move type game, if anyone with some experience has some spare time to look at it I made a post over at https://forums.unrealengine.com/t/issues-with-aicontroller-based-topdown-character-and-replication/535061 explaining the problem in detail, any help appreciated 🙂
Hey, I’ve been banging my head against this problem for days and figured its finally time to ask for some help. I’m new when it comes to Multiplayer and replication so bear with me. I’m making a Topdown based multiplayer game with point and click movement controls, but in order to achieve stutter-free character movement I followed this tutorial...
I managed to make my pawn move!!, it works if I move it with addactorlocaloffset before I was moving it with addmovementInput
AddMovementInput only does something if the pawn has a MovementComponent.
To start with, what do you think casting is?
yes, my pawn has a MovementComponent, but AddMovementInput doesn't work on clients only on server
Casting in this context is just related to conjuring a spell 🙂
Whether or not a clientside AddMovementInput will do anything is up to the specific MovementComponent. CharacterMovementComponent automagically does the networking for you, not sure about the others.
So is an ability an actor? If so, you should spawn it on server only and let it replicate
Anyway, if you're not possessing the pawn, what should be going from Client -> Server is basically orders ("I want Pawn X to try to move to position Y", or "Tell Pawn X to begin casting Fireball at Pawn Y")
That'd be routed through your PlayerController
Yep all that is working and not the issue, the problem lies in trying to play the "Cast Spell" animation montage. I cant seem to have it play on all clients because the character is owned by a serverAI controller. I have no idea how to make the clients run the animation on the server so it can replicate
Well, what I wanted to do is be able to move a pawn that has a camera, but I don't own it, I just change the player's view to it, and then from the player I send the input to an event that moves the pawn, since this movement only sees the player locally, I don't want to replicate this pawn. locally it works correctly and it also works for the server, but the client cannot move the pawn even though I see that the client executes the event and sends the input to the pawn.
This is your problem
You aren't the owning client. The server is
You can only call Run On Server events on things you own
Right I thought so, but this is because I need the characters to be server owned.
So either move that RPC to your PlayerController or somehow get ownership of the pawn. I'm not sure if ownership of a pawn can be seperate from possession, that's worth testing.
That is, I don't know if you can own a pawn but not possess it.
@regal mica
I think that for the moment I will leave the pawn moving with the addactorlocaloffset, I will try what you mention with more time
Thanks for comments 😊
Ive tried doing the same on the player controller, but its not working. How would I go on about getting ownership of the pawn? Ive tried SetOwner without any luck, what else can I do?
Does your player only control one dude or many?
Just one guy (like in the vid in the link)
If AI isn't a big deal then just use the regular possession and click to move like in the template project
Or you can just put the RPC in your playercontroller like
ServerCastSpell -> get MyDude -> MulticastCastSpell
Basically the characters are possessed by a server based AIController and go where the client based click to move location is indicated. This eliminates any stutterings if there's lag in the game
cool Ill give that a try
You can use click to move without AI controller btw, look at the template.
CharacterMovementComponent is fully capable of navmesh movement
I know, but I experienced stutters because I need to have low Ground Friction and Brake distance on the characters
