#multiplayer
1 messages Ā· Page 99 of 1
Try splitting up the array like you did before and delay between. See if it improves it. If it does, then it's likely it's just too much data to be sending so rapidly.
If you're calling the function that generates the bones array on tick or something, put in some flipflops on tick before calling the function, see if that helps too. (Tho expect some chopiness until you implement some interpolation)
Hi !
I've been playing with GAS etc, and I would like to be able to get the replicated Camera manager on the server ...
I've tested Lyra, for instance, and they are able to do it
but no dice on my end ...
Do you have any leads ?
thanks
this works on the server
Well, finally found it
Use Client Side updates
I have a replicated actor with a replicated subobject. When the client goes out and back into net cull range the actor gets created on the client again. This makes sense but because the subobject is replicated it gives a reference to the server made one, however on the client now the Outer for the subobject is invalid because it replaced the old. Is there a work around for this or are outers not ment to be used in a multiplayer setting?
Widgets do not replicate.
Local computer only.
You're referencing nothing as that reference doesn't exist on the client.
Even if you mark a widget reference variable as replicated, the widget itself does not get replicated to anyone, so only the local computer can reference it.
Repnotify of what? There'd be no repnotify of a widget being replicated as it can't replicate.
We need a bit more info tbh
And you can't answer the local variable question easily cause it depends on the context
And the widget is what/where?
You can simply do IsLocallyControlled in the OnRep if it is in the character. And then access the PlayerController and from it the widget
Then only the owner of that character would modify the widget
I wouldn't have such a boolean in the character though
I would have it in the GameState. And in the OnRep I would just get PlayerController 0 and then do the widget stuff.
That ensures everyone does it with their own local version of the widget
GameStarted
That's bad code
If you need the widget in the character, use OnControlledChanged in the Character, limit it to IsLocallyControlled and access the widget there
GetAllActorsOfClass is most of the time not needed
When the pawn/character is un-/possessed and the Controller pointer changes
Should be somewhere in the list of overridable functions
I'm making a co op game. if my player starts a game without an internet connection and then regains an internet connection. Can they then invite online friends to their session. Can I change the session from lan/offline to online seamlessly?
Yeah you can use Online Beacons
did you find a solution for this crash? we're also getting this assertion error
No, current suggestion I made is to not use WorldPartition if not needed
do you know if there's a bug report ticket I can follow?
If anyone is experienced with the UE5 FPS Game Starter kit I would appreciate a helping hand, Ive made a class selection widget, and the entire blueprint string works when you select sniper but the 2 highlighted nodes, the weapon doesn't actually get given to the player and Im confused as to why
Nope, haven't found anything
Where in the engine is the code responsible for replication described? Where is it better to start studying rep inside?
I have a bug with my matchmaking system using blueprint gamelift can someone help me
is this the way id wanna replicate a montage or would i use switch has auth to run a multicast if its server and a server event if its client?
since doing this makes the notify get called on server twice?
So I'm brand new to ue5 and I'm wondering when I follow a tutorial on yt on how to make a mutiplayer system it only works on my local computer when I open 2 instances, but when I send it over to someone else they can't connect? I know I'm missing something but no yt vids explain it very well. BTW I'm trying to make a p2p mutiplayer system with lobby list you can join
is there a way to keep a map loaded while doing Client Travel, and only unload the map once the new map is loaded? (like a no-seamless travel). When I try ClientTravel it immediately unloads the map that the client was in
guys someone set up a matchmaking system with gamelift in blueprint in unreal engine esque it turns out that I'm having problems with servertravel for my players to travel to the game level
anyone encounter issues using PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute); in UE 5.1? (client travel doesn't seem to work even though the address and connection is valid)
I'm still using 4.26
What I don't know is whether to use seamless travel
I'm using gamelift blueprint
The problem with this is that when users find each other through matchmaking, sometimes they do not travel synchronized and stay on the server map without traveling.
After repeated failures with a "true" first person char for a shooter, I went back to the fps with arms and a full body mesh on the same char that others see (replicated, of course) I have visibility working (thanks to some here) and weapon angle working.
How should aiming and projectiles be done? Right now I get camera to center screen, then trace line from gun muzzle to previous screen. This gives some odd looking angles from gun muzzle outward. Is this the "best practice" way to do this?
Has anyone seen an issue where the USOCK_Closed is triggered too quickly? So I am doing some ApproveLogin() stuff, and reject players for invalid passwords etc.
I can replicate on my machines that 80% of the time the rejected message is passed to the end user. But sometimes the end user just gets a "your connection was lost" generic error, because the Engine does a tick and sees USOCK_Closed - and then just kicks the user immediately.
rebumping
if items are being attached to clients when they use them from their inventory, should i be handling that logic in player state
and how do i make clients see each other when travelling to new maps? is that set up after you have a dedicated server
What do you mean "see each other when traveling" ? While the map is loading?
i mean after
So you change map and then everyone gets disconnected?
they go to their own copies of the level instead of the same one
I don't really understand server checks, let's say I'm making a cod game where the player is buying the weapon. I think a good server check would be to check if the player buying even has the points, but what if a "hacker" is 100 meters away trying to grab the weapon? Would I simply check the distance to? Would I check if they are facing the weapon?
You should check everything.
Can they afford it? Are they in the right place? Do they have space?
Etc.
Native Unreal if you have a client move to a new level, they disconnect from the server and open into the new map locally.
Obviously if this is for something you do every frame you can't check evreything every time.
i noticed
That's exactly what you would do - verify that the player can do the action you want them to do. I wouldn't go to the extreme of making sure they're facing it, but at least within range of it to be able to do it.
It really depends on the game and what you want to prevent players from doing.
Okay, thanks for the heads up on this, was just crossing my mind for a bit
I guess I should've really replied to this - so the issue being is that since clients disconnect from the server when they open a level, they are no longer in communication with eachother, and the server can't move individual clients to a new level it can only move itself and either disconnect or bring along its connected clients to the new level. This means that Unreal's networking doesn't facilitate having multiple levels running on a server that clients could be in while still remaining connected to the server. There are plugins out there that can put players into different non-replicated worlds with individual levels while still remaining connected to the server, but again, they're not replicated so others cannot join in that world and the server wouldn't be in control of that individual's world. To facilitate having multiple worlds on a server with replication would require massive engine source changes.
im using playfab, i think i have to figure out the player sessions or somethin
anyone possibly know why I am able to get a successful connection to a host, but ClientTravel is not working using this in UE5.1
APlayerController* PlayerController = GetGameInstance()->GetFirstLocalPlayerController(); if (PlayerController) { PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute); }
I think what you're thinking Playfab does is provide a layer on top of Unreal's networking that makes it easy to keep communications open between clients and maintain server authority, but it doesn't, it only provides you with external tools that can facilitate communication between servers, and a means for hosting servers for you. You'd have to either make changes to the engine to facilitate multiple worlds and having them replicated or you will need to run multiple game servers if you want players to be in different levels but still have the server maintain authority, which means you're effectively building out a sharded MMO.
If you have clients running their own sessions (thereby, they become listen servers) and somehow maintain communications between them through PlayFab's networking, you can't securely use Playfab for those now client hosted servers as they would need to have read/write access to databases and leaderboards which means that someone malicious can easily spoof information and completely destroy your database or leaderboard.
what about match id's
Hello, I have a REST online service API that I wrote. For example, I have an endpoint about whether my service is up or not. I check this from within the game and continue the process according to the situation. How should I write such a code in this case? The point that confuses me is that the method call here is asynchronous. For example I can make the request and then set a bool variable true in the callback and check the value of the variable every second?
Regardless of what types of IDs playfab can provide, it won't be providing you with a means of having multiple levels running securely on a single game server, nor facilitating clients to securely host their own levels.
Sounds good to me, maybe add a timeout.
After 10 seconds of try (that means 5 or 10 try) I can decide failed or sucess
in success case I can set bool false for next request
I have been investigating my override of GameMode::InitNewPlayer and it does not seem to be getting called. The game mode class where I override it is the parent of two child game mode classes that are strictly blueprint classes.
It does appear though when I test connecting with a client that they are connecting to the server.
Is it possible the override of init new player is not being called because my default game mode is the blueprint class with no c++ and that is not calling the parent override?
Not really
Are you mixing GameMode and GameState with the Base version by chance?
E.g GameMode and GameStateBase or GameModeBase and GameState
Cause that's not supported and might cause random side effects
it is defined as
UCLASS(minimalapi, Blueprintable)
class AMultiplayer_GM : public AGameModeBase
Try inheriting from the non Base versions (:
thank you I will give that a shot š
it compiled locally switching to inherit from AGameMode instead of AGameModeBase, I don't have gamelift local working yet so I will be deploying a new fleet and will know in about 30 mins if the servers start using that initnewplayer function.
how do i disable collision between client pawns. i tried using the details panel but wont work
i need them to spawn directly ontop of eachother and they just launch all around after colliding
what could even be causing this? as you can see it works fine on the players end, and replicates fine but then just snaps? https://gyazo.com/ea500b53aeb1188263cded416d915ad2
its specifically as soon as it starts going upwards, I really dont get it, theres nothing that should be causing this and its fine looking fully down
Could set the default collision on the capsule to ignore the pawn channel but does it have to be only on the client? If so the server is going to issue corrections and cause issues.
server
Server what?
If you want pawns to never collide with one another then just set that as the default on the capsule collider. Ignore pawn channel using custom collision.
do I just click around randomly until something happens to fix my problem as usual
tried but didnt work
That or breakpoints and carefully step through the nodes looking closely at the value of each variable output to see if itās what youād expect it to be.
Are there other components outside of the capsule which could be colliding? Showing a screenshot would help too.
ya on sec
one
ive got a shadow underneath the player but i added that after the fact
Okay
And the thing heās standing on does that block pawn?
no
Is the other character the same class as this one?
yea
And the capsule is the root component?
yea
Are you changing the collision during runtime anywhere?
im not
Well then it should be working youāve missed something somewhere
Could it be the skeletal meshās collision perhaps?
With other pawns
i set that to ignore collision too and it didnt work
ive had the issue for a long time and no one else know whats goin on either
Start the game then pause it and inspect the character does it have the correct collision per component? If not youāre setting it somewhere.
Thereās also an option for the spawning node to ignore collisions or move if necessary.
its set to ignore collision too
im not sure what you mean by pause and inspect
im pretty new
When the game is running you can alt tab if full screen or just minimize and pause the simulation (play button becomes pause) shift + F1 to escape the mouse from game.
Then once itās paused you can click on the other character or just find it in yellow on the world outline panel to inspect it.
noticed collision is greyed out and says this for the player start
and pawn isnt ignored in these settings
Wait thatās the player start not the character
hi it's me, the APlayerController::ClientTravel guy 
do you think that could be where the issue is? should i try spawning instead of using player start?
The problem is on the characterās collision. The player start is just a location that has a capsule using default size so that characters donāt spawn inside of a wall or something.
ya idk where i shud look for the issue then
So I'm having troubles with ClientTravel(), the connection is valid but the joining user doesn't travel. I've pinpointed it down to it being specific to the ClientTravel function with my debug messages. Any help would be appreciated tomorrow will be day 3 of me debugging this
if (OnlineSessionInterface->GetResolvedConnectString(NAME_GameSession, Address))
{
Defrog::Print(FString::Printf(TEXT("Connect string: %s"), *Address), FColor::Yellow);//This is reached
}
if (APlayerController* PlayerController = GetGameInstance()->GetFirstLocalPlayerController())
{
PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute);
Defrog::Print(TEXT("PLAYERCONTROLLER IS VALID"));//This is reached
}```
@visual glen Is there a reason you dont want to just use UGameplayStatics::OpenLevel?
What does the Logs tell you?
What does the Address look like?
I need to connect to the IP address and didn't think u can do that with UGameplayStatics::OpenLevel
I will try that out and look into the logs and address (I haven't used logs yet for debugging tbh)
Always check your logs man.
Thats literally what they are for
Debugging
To help understand what your program was doing
needed to hear this tbh ty
can we use UObject if we want to create inventory items in C++, which is only data and will not exist in the level ?
Yep
Keep in mind you have to do extra work to have them replicated, if thats something you might need.
I already replicated the base item for inventory which is only data.
now I want to know if I want to create that item in C++ , I should use data tables with it or how?
they need to be filled I mean
at the same point, why I should'nt use UStructs , oh they are not supported for single property replication , right?
if item is replicated, it should be spawn by server, it will be available for the world.
if(authority)
{
SpawnActorDeferred....
.
.
finish...
}
Deferring spawn is usually just to enable to you init the Actor before it runs its construction. You should always finish spawning it, why would you be wrapping it in an HasAuthority?
Seems rather pointless to do that since the Server has authority and its the only one spawning the Actor so it will always run anyway?
This also sounds like your issue is elsewhere
Perhaps you forgot to call Super:: somewhere?
is it redundant to first call a run on server funtion that then calls a multicast? can i just call the multicast directly?
Multicasts can only be called by the server. In this instance, you probably do not want to spawn the actor on through the multicast and instead spawn a replicated actor on the server.
But if i for whatever reason want to use a multicast i would need to do it the way its setup now?
It depends on you called in on server or client side. You probably need to make it clear first. Like which event/function would be called only on server, and which of them are called only on clients.
but if the call is made from the client i need to call the multicast from the server. in other words. chain the functions like the screenshot?
If in this case, yes. It is exactly as you did.
Great thanks. im just prototpying now. so il probably change it to be replicated actor instead soon. I just wanted to make sure i that i understand the multicast correctly
Also on a side note to this. Why multicast a building spawn? Shouldn't you just have a replicated building actor that is created on the server?
Probably he said he's going to refactor this later as he mentioned?
I was more wondering if there was a specific reason for it. Because just spawning the replicated actor on the server is much easier than a multicast with a lot less bugs.
For starters. If a new player joins, no previously spawned buildings will show.
Yeah, that's the problem.
when using the Push model, is NetUpdateFrequency taken into account when I do MARK_PROPERTY_DIRTY_FROM_NAME ?
my understanding is that the traditional replication model will only replicate the change on its next "cycle" when its checking properties for changes so it may take a while if NetUpdateFrequency is low, but using the push model, when I mark a property dirty, that is instantly replicated right? kinda of like a ForceNetUpdate() but for properties only
Does any client have access to change replicated properties? or does it have to be the owner of the actor?
https://docs.unrealengine.com/5.2/en-US/property-replication-in-unreal-engine/
For an FPS multiplayer, with a character that has FP arms mesh and full mesh for other players to see, you shoot bullets out of the FP gun, how do you handle the bullets from the full mesh's gun that others see. Obvisouly we want the FP guns aim to be what hits others, but not sure how to show (laser bolts for example) from the full mesh others see?
Let me try again: So what's the current status of IRIS?? There is no mention of it in the 5.3 roadmap. I didn't find anything in the forum either. I was also wondering, if it has some client prediction stuff. The situation seems a bit messy regarding this currently in UE, at least it is not clear to me what the current systems can or can't do and what future stuff is in development, if there is anything in development at all.
Yeah its just temporay. i needed to call some additional functions on spawn. so it was just a quick "hack" to execute them on all clients while i work on the spawning system
so anyone have any ideas about this? I dont even know what causes this in the first place so it may even be an animation problem for all I know, but its only happening on the other end https://gyazo.com/fe44424972cc5ac43abd17995cef47c7
Under active development. You can see what code there is on ue5-main branch on GitHub but last time I looked it was just an empty plugin. So in other words it hadnāt even left the original authorās local dev environment yet. But that was a few months ago.
Technically yes a client can change the value of a replicated variable BUT it will be corrected by the server once the next NetUpdate occurs which is 100 times per second by default. I think this can be used for client side prediction if thereās also an RPC that changes the same variable to the same value but the RPC might actually do that change locally anyways by itself. Most of the time itās the server who sets the value of a replicated variable.
If a client changes the replicated variable it only changes for them locally and other connected clients wonāt receive the change.

one of those super specific problems isnt it
just kinda hoped someone had seen something like this before
maybe itll be fixed in a few more days of random clicking
Might help if you explained the issue in more detail again and showed blueprints. People here probably donāt remember the specifics as well as you know them.
I did reply to where I originally sent it all
but Im not sure any of it will help
because I can take it all apart and input values manually and it still breaks the same way it makes no sense. nothing is changing it
I just saw a gif that didnāt have any context or meaning to me. Sorry
I suppose you can rule out animation vs replication issue by testing in standalone vs as listen host.
It looks like thereās no replication at all in that last gif you showed. Also which one is client and which is server? Left or right? Maybe make them different colours just for debugging?
yes its replying and you click the reply and it takes you to where I sent other stuff
but again I dont know if it even IS a replication bug. everything is clearly replicating fine but it decides to do this. Ive looked everywhere and nothing could be causing this because it does it when I take pretty much everything out
When what does what? What is āitā? What did you take out?
Please describe the issue in detail and provide screenshots of blueprints. Because from looking at the gif I donāt understand what the problem is. Is it the ghost wireframe white mesh floating above them? Is it because one character rotates at the start but the other is already rotated? Is it because the arms are moving on one but not the other?
ok, but since it is not mentioned in the 5.3 roadmap there are no big improvements being worked on that will release any time soon or can this appear also later on the roadmap?
ĀÆ_(ć)_/ĀÆ
oh god
I showed everything in the original post it felt stupid to post it all again so I replied to it which lets you click that which takes you right to those messages. theres a gif there that shows both players screens
you know, EVERYTHING. as in everything else extra that was in the script. literally just sends a rotation value and sets that on the other player. yet somehow it has a problem
so sure Ill send it again but theres no point because it still does it when I remove all of that anyway https://gyazo.com/ea500b53aeb1188263cded416d915ad2
I see that itās working but is the problem the arms have a slight delay? What if you increase the net update frequency at the start of arm movement then decrease after to keep the network optimized?
cant you see the snapping
Hey hope you don't mind me asking but did you find a solution to this?
Does it still snap like that if you dynamically increase and decrease NetUpdateFrequency?
not exactly . it started working again when i stopped launching as game and instead played as a standalone. standalone is a more accurate simulation apparently
I dont know how you mean
hmmm noted, will try that out thanks for the response!
Well you can start by increasing the actors NetUpdateFrequency so replicated properties are made to replicate faster. Also not sure if itās ticking every frame or not.
If that solves the snapping then itās probably a good idea to reduce that value. But I just remembered thereās a built in thing called adaptive net frequency (itās deactivated by default) you can read about it here: https://docs.unrealengine.com/5.2/en-US/property-replication-in-unreal-engine/
I dont see how this would help, it very consistently has an offset when the player aims up at all
New to multiplayer but as far as I experienced, replication cannot happend that quickly. You will probably have to use interpolation for the Aim offset, at least that's how I see others doing it
but the aiming works fine
it just suddenly adds 90 degrees or something when looking upwards
works fine in your own machine I believed?
nah both its completely smooth
or do you mean itll be different when testing across to other pcs
I mean it only snap on the left screen, not the right screen?
yeah
Yeah , so if you are playing in your own machine, you are fine because you see everything real time
while the other machine that is fed with the rotation cannot keep up (maybe)
the actual aiming itself is perfectly in time
Have you tried to print the value
of what ever drives that rotation
If you use Aim Offset, there is a common problem people experienced
nah it just rotates the bones
Mainly involving the offset, goes from left to right, or up to down instead going to the closest number
Yeah nvm you are not using aim offset
So I still think it's snapping because you are not interpolating
but its completely fine looking from centre to downwards
Hmm I see they are rotated differently as well
yeah thats the whole problem
good luck
yea looks like at certain treshold it just went crazy
I know FRotator get compressed for replication in Character Movement Component and it does funny stuff which require us to Map the value. Not sure outside of CMC tho
It could be because of the rounding. I know thatās something which can be changed to be more precise at the cost of more data being sent over the network.
seems to be gimbal lock? which is what I assumed originally but I dont see how it could be since I pass the whole rotator through https://gyazo.com/97f0b71dbaa5641cc24bb3b8969ef4ad
Ah I get the problem I think?
actually nvm, seems like server and client gives the same value?
Anyway your value went from 0 to 360
yeah
pretty sure thats gimbal lock
because something cant rotate in a circle without having to flip one of the axis
Earlier you have a screen where it is working fine
I assumed that's the host/server?
yeah
Try to print the value on server side
Im thinking somewhere it must remove the other two axis when it sends them
I think you just need to remap the value on client side
Can you do the same with last video but on server side
still same thing but I think the problem is that it isnt sending all 3 axis to the client https://gyazo.com/71e6e404e94006b752511e61435cc3ce
dumb question. when marking a struct as dirty, i assume it marks every property in said struct as dirty for comparison? if one property replicates after being marked dirty does the struct go back to not being dirty or do the other properties individually stay dirty until they replicate?
looks worth checking it out, i don't assume things will be just fine when you are missing one axis
Anyone happen to know why my logs show my level package URL as /Game/FTW/Maps/LobbyLevel even though its asset name as /Game/Maps/LobbyLevel?
This would be a good question for #packaging
Time for you to read Cedricās network compendium in pinned.
this is unrelated to you issue but your game reminds me of plasma burst 2. is you game inspired by it by any chance?
hahah yes lol
I was actually thinking of doing something like the saw maps since co op is naturally a lot better than pvp in multiplayer
just wanted to update to you that after lastnight, I learned how to use logs and was able to diagnose my issue and it now works as expected. thanks a ton for the messages!
awesome! man i really loved PB2! shame that the sequels seems mostly dead now, i kinda wanted a continuation for it. and yeah definitely the death maps were a lot of fun.
wish you the best of luck man!
thanks, the sequel is still being worked on actually, thereās occasional small updates about it, and funnily enough happy wheels 2 has been āin developmentā for about 10 years now because thatās also a solo dev too
how do i make the game know im clicking on another client so i can pull their personal info like name etc
Afaik, you need to access their player state when clicked
so their name and stuff should be within the player state?
Click -> figure out what pawn you clicked -> get that pawns PlayerState -> cast to YourPlayerStateClass -> access the info
that's if it's replicated data in PlayerState
if you mean to request some data from the server it'd be like
Click -> figure out what pawn you clicked -> call run on server event passing over the pawn or whatever
all pawns use the same blueprint
thats fine, you still need to figure out which one you've clicked on
That is, which instance
Click -> get pawn you clicked -> get its playerstate -> get the data
how do i make it recognize which pawn i clicked though
Thereās an onClicked event you can override
Or you can do it yourself with a line trace or get hit result under cursor
Get as far as printing out the display name of the actor you click then get back to us
Goddamn default to super reacts lol
question about the line tracing. if im using a topdown camera how do i plug that into the location input
How far have you gone so far on the top-down aiming system?
Do you have a cursor you can move around?
no aiming, just click to move around
right click to rotate, left click to move the pawn
Show your left click code
Why you do this to the poor IA? š«£
idk i copied a tutorial
If you run Get Hit Result under Cursor you can tell WHAT ACTOR you hit
Do you want data on click or on hover?
click
i have it so you open players inventory when you click on the pawn
so i should be adding code to there correct?
So there's 2 ways to do it
you can use the built in OnClick events
OR
do it yourself
I'd maybe do it yourself since you have click to move too, that way it's consistent
ya, speaking of that i have an issue where my pawn moves if i click on another pawn when i dont want it to
followed a tut
me2
Is the timer for click and hold navigation like Diablo?
let me check
I bet it is
if you click and hold and move your mouse around does the dude follow it around?
seems to be reversed from that, when i hold the click the player doesnt move til i release
not even interested in that feature
yeah that's probably because of the stop movement node
delete the timer for now
Start by understanding what this does
Triggered fires when you click
As does started I think, and completed when you release
not 100% sure as I haven't used the enhanced input system yet
start with just using Triggered
Click:Triggered -> get hit result under cursor -> draw debug point -> print display name of hit actor
get that going
it should draw a point where you click and display the name of the thing you clicked
isnt this left click logic just to help me prevent movement when i click on a pawn capsule
wouldnt i need to draw the debug point from the code where i open the inventory?
Start from the basics
make sure you understand that you get 2 things when you click. The click location AND the thing you clicked
Then you can branch, only walk if you DON'T click on a pawn
even if i have a on event clicked for the pawn capsule?
I wouldn't mix and match tbh
oh ok
I'd do it all here
one last thing, whats a good way to call if the pawn capsule was clicked so i can detect it
am i casting to my topdown character and then pulling the capsule and then something else before it plugs into a branch
no
Get hit result under cursor
you don't want to get the local players pawn, you want to get whatever got clicked
true
Here's what your code will literally do:
Click -> get local player's pawn -> cast it to BP_TopDownCharacter -> branch
doesn't make any sense
get hit result under cursor -> break the hit result -> cast HitActor to BP_TopDownCharacter -> now you know if you clicked a BP_TopDownCharacter or not
I'd do hit result by channel
ok
you don't need that branch right now
if cast succeeds, you clicked a dude
if it doesn't, you didn't
so right now if cast fails, walk to the location
My projects have looked like black voids with debug prints since 5.0 lol
pawn doesnt move when i dont clikc on the player
š
doing some low level stuff
show code
its just last pic minus the branch
do the walking when the cast FAILS
the cast is a question "IS this actor a BP_TopDownCharacter?"
lol sorry i forgot that
Cool, you're on your way
ive got a owning player inventory widget and other player inventory widget and this is the code to open the owning player widget
this is in the chracter BP
So call OpenInventory on the succeed of the cast from get hit result under cursor
Click -> did you click a dude? -> yes -> open his inventory
-> no -> walk to the click location
i cant use is locally controlled in the player controllerBP tho
i was using that to determine whether to open owning inventory or other inventory
You can check if other actor = self.pawn
how do i do that
oh
self -> get possessed pawn or whatever -> equals OtherActor
that'll tell you if the OtherActor is the PlayerController's possessed pawn or not
?
yea
and plug that into where get player pawn is in?
plug it into one of them, plug the hit actor from the hit result into the other
you're checking if the hit actor and the controller's possessed pawn are the same actor or not
which is what you care about
isnt working
You are checking if self and the hit actor's capsule component are the same thing
you want to check if self's possessed pawn and the hit actor are the same thing
oh ok
what specifically do you mean by self possessed pawn
owning pawn doesnt work and getting player pawn off self ref doesnt work
@dark edge
nice it works
now that i got that part sorted out, back to the original question. how do i make the other players inventory unique to them? ive got playfab hooked up so im able to retrieve player id's and stuff but im not sure how to make it visible to the owning player
you previously helped me get the hit actor character number but if i were to connect an id to another player that isnt owner where do i even start... you said player state?
so pull the player state from the hit result?
how do I call these functions in C++?
do I do it the manual way? if(Function_Validate) Function_Implementation;?
also, just to make sure, only Server RPCs require validation right? So if I call a Client RPC is doesn't need that validation function?
it tells you right there
if you add withvalidation to the ufunction declaration, you then add a _Validate function like shown and return a true or false
so manually right?>
no it'll automagically call it
you just make a
bool YourFunction_Validate()
and have it return a true or false
so do I just call foo() which UHT will generate and it will automatically call both validate and if validate is true implementation?
yes
okay great thanks
and if false it'll disconnect the caller
from a pawn you can get their playerstate
but you need to decide if inventory goes on the pawn or playerstate, I'd lean towards the pawn
whats the difference?
Do you know what a pawn and playerstate are?
i know pawn, idont exactly know playerstate. currently i retrieve the logged in user's playfab id and put it at the top of their inventory window
you sure it's not automatically launching the server in the background and connecting?
I like to have 2 batch files to launch a dedicated server and a client so I can test from startup and not have the PIE complications
Client
"C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "%CD%\Islandgame.uproject" MainMap -game -nosteam
Server
"C:\Program Files\Epic Games\UE_5.0\Engine\Binaries\Win64\UnrealEditor.exe" "%CD%\Islandgame.uproject" MainMap -server -log -nosteam
like that
you can certainly do it in PIE as well but this is closer to the real thing
I think the Third Person Character Template in C++ doesn't move by default? I set the the CMC IsReplicated to true but not sure what else I have to do
the Client can't walk around at all
we have 1 map total
It should load whatever map you want it to load in to
maybe an empty one that fires up a session, who knows
none of it, that's on you
an entirely new process is spawned
same as if you ran that bat file 10 times
that's on you and/or your game manager like GameLift (i think idk) or whatever
definetly not trivial
In c++ is it not as simple as just setting replicate movement to true
Or did unreal do something different for the sample project, because right now the client can't even move and the server doesn't update it's position to the client
I mean it's not really Unreal specific
Unreal stops at the process, it's up to you or some other product to handle spawning the processes and deploying virtual machines etc
if you have to ask, do not try to make this lol. You'll just end up with a $250k AWS bill
Hmm that's weird that the character isn't working
you haven't shown any code so how would we help
show how your character moves
the code path from input to the server doing the move
Just the template code, third person template, was hoping someone here used it
Hmm
Was I supposed to call super on the GetLifetimeReplicatedProps
Because I overrid it
yeah you probably want the rest of Character to replicate its properties
Ahh, that's probably it then
if i have ignore pawn on my pawn and collision capsule why are my pawns colliding
show the collision settings
check PlayerShadow and PlayerRing as well
worked, thanks
characters are still stepping up on something or theyre getting bumped up vertically a bit when they pass thru each other
ive got no step up on everything though?
Just make sure everything has no collisions except the things that you want collisions on
i did.. im confused why this is happening
idk what playershadow and playerring are but they sound like visuals only
theyre set to no collision with ignore pawn checked
print the hit component on event hit and see what comes up
Anybody have any tips regarding debugging RepLayout->ReceiveProperties FAILED and Error: ReceiveProperties: Invalid property terminator handle? It's causing my player to disconnect and from what I can see regarding the implementation, its not doing anything other than spawning like 20 actors, and its over multiple frames so nothing happening super heavy CPU wise...
I created a project from the third person controller, and I added a first person camera to that blueprint. I now want to make it so the player model turns as the player looks around (so other players can see what everyones looking direction). Do I need to write my own networking code to make this work or does the default player controller support this as an option?
i know for a fact its making the pawns step up onto something but everything is set to not step up on any of the components
could it be the swing arm and camera?
idk print the event hit and see what it is
Event Hit
im pulling what from what output
break the hit result and you'll get all sorts of info about the hit
you want to print the hit actor
what am i getting out of the hit actor?
drag it into a print string node
doesnt print anything
could it be because they are only stepping up onto something?
theyre feet lift up but thats it
Hi all, I'm having an issue where an actor becoming relevant the first time on client gets the proper replicated value from server, but getting destroyed and respawned from going unrelevant to relevant again results in just having the default property value
Is this typical? I'm doing some weird stuff with procedural generation and manually matching actor names so it might be on me.
Does the capsule move?
That sounds like your animation IK
it can move up if they are directly on each other but if theyre just passing thru each other it only lifts the feet
Might just be your animation
i disabled animation and it isnt doing it anymore but why would it be doing that specific animation if there is nothing to step up on?
you are probably using IK which doesn't even use the collision but does line traces
are these functions only called on the server? only prints hello on client 1 so making sure
and would this be called on the server if I did BoxComponent->OnComponentBeginOverlap.AddDynamic(this,&ACoin::OnOverlap);?
If that variable is marked as replicated and is being set by the server, then the actor should end up with the replicated value.
No. They can happen on clients and server. You can usually use an "Is Server" node into a branch or a Has Authority node to determine whether it's happening on the server or a client.
so whys it only print hello on the server?
It's printing hello on client1.
It seems like you're probably destroying the actor or something as well somewhere? Is that part of the overlap?
my code to show a chat bubble of what the owning player entered is everything but the highlighted yellow part. it is multicasted and then replicated but when someone enters chat it shows up for both clients. how do i make it so only the owning client has the chat bubble? at first it shows chat bubbles above both clients and then anything else that is entered into chat is above the opposite client that isnt the owner
Is this like for WoW style chat bubbles?
You probably don't want to get all widgets of chat bubble. You just want the chat bubble of the player that sent the message.
Are the chat bubbles on widget components in the world or are they widgets in the viewport?
its a component attached to the pawn
Then why are you getting anything?
or rather, getting all of class?
ur right
just get MyWidgetComponent -> get widget -> cast to YourChatWidgetClass -> call HeyIGotANewMessage
alright ill give it a go
Finally someone here actually has a good use case for multicast
I saw multicast and got triggered but this is a good use for it lol
lol
i forgot to mention it creates a chat bubble widget, then creates a chat result widget(what was entered into chat), and then it adds chat result into chat bubble widget as a child and i havent touched this in a while so im a bit confused on where to start with your suggestion
why does it only print hello on client 1 though?
its like that because the original use of the chat result was to add it as a child into a global chat box
so i just took the result and threw it into a bubble
What is your Server_CollectCoin doing? If it's destroying the actor then that could be happening before the server's blueprint copy detects the overlap, but not before the client's version gets destroyed.
If my linetraces/projectiles replicated and can be seen by all players when "Play as Client" but only local players see their own stuff when "Play as Listen Server", what have I missed?
oh, you are correct, really great assumption tbh
thx for the help
assuming your system works fine on the widget level, just add a chat result on that multicast. No loops or anything
the chat result is attached to the multicast in the code though (in the circle)
and you mean this right? to get the chat bubble component on the pawn
so i did this and now it shows the chat bubble on owning clients screen and on other clients screen it shows it on the wrong player, which it was doing before but this time its just over the wrong players head
are dormant actors replicared to new clients when they join?
@dark edge
Is it normal having to restart dedicated server once a week due to it starting to lag?
I'm not sure from the view of a developer, but usually playing the online games, they often had server reboot at 4-6 am once or twice a week. I think it depends on the size of your game. If it has lots of active users, it is very possible you need to do that.
You need some better way of identifying who the message is from and determining the widget that should display it. Using "Get All Widgets of Class" doesn't return them in any sensible order that you can use.
what you recommend i use
Whatever you can use to identify the player that sent the message.
i havent figured out how to do that yet
No player ID value that you may be storing in say the playerstate that also gets sent in the message?
havent been able to work on that cause i think i need to set up a dedicated server to get playfab users in the same instance
unless im wrong
which i usually am
meaning, i can log into 2 dif accounts but they wont be on the same level
Well, as it stands, if you don't know who the message is from in any meaningful way that you can cross reference with your players on the server, there's no way to know which widget should be getting displayed.
true
is there a way to get a client number or something
like how the windows says client1 and client2
Technically there is, but that's still not really what you want to do as the client IDs that the game provides isn't maintained well or accurately across all instances. You're better off using the playerstate to identify a player.
A working example of what to do in normal Unreal networking style chat that also requires players be in range to receive it and display the chat bubble would be:
- Characters have a widget component attached to them that holds their "Chat Bubble" widget.
- Chat Bubble widget on construct can bind to an event dispatcher that is present on the owning player's pawn that can update and show the widget as needed.
- At game time, a client inputs message and hits enter.
- Input is sent to server via sending an RPC to server (probably through a social component on the playerstate or character)
- Server multicasts the message on the social component that sent the message.
- The multicast is received on clients on the social component of the character/playerstate that sent the message so then you just need to call the event dispatcher set up in step 2 and the chat bubble widget should then display.
This doesn't include displaying it all in a chat box, or handling messages from anywhere in the game mind you - there is net culling that'll happen so the multicast wouldn't be received by those who are outside of the culling distance.
for clients that won't receive it because of the net cull, storing clients on login and sending the message to each client is a good solution maybe
A better way would probably be to multicast in the gamestate and have a "Message Received" event dispatcher from there that widgets could bind to and include the playerstate that is sending the message so that when it is received, clients can look up the pawn to signal to it that it should show the chat bubble.
This would then also allow for a more "global" type message to go out so a chat box may receive it, but the chat bubble may not need to be displayed since the character isn't in cull distance anyway.
Having a bit of trouble finding sessions. Just started a new project, boot 3 up as clients, then host creates then the others search. The host creates with "Open Level by object reference" and has ?Listen in the options. Is that correct?
That should be fine, yes. Did you do the other ini config bits?
I havent no, maybe thats what ive missed
Dont suppose you have a link to the page that runs through it? I do remember seeing it months ago
Also can i test with the steam subsystem and overlay whilst in the engine? or would i need to compile each time
Sadly no with Steam - you need to have different computers to properly test it (wtih separate Steam IDs I believe)
Ok for null subsystem, you don't need to do any ini edits.
Lemme see if I can find the Steam one...
Ah rogey, ill probably not use steam at all to start with then
i want to be able to test in the editor
then can swap it all over later once im happy with it
DefaultEngine.ini:
#multiplayer message
That's the one I put in and am just testing with advanced sessions plugin in editor using UE5.2. Seems to work fine.
Thats how im currently trying to do it, although its not finding any sessions
have tried using 3 clients or 3 standalones
yeah i tried it every way just to make sure haha
same result with ?listen
wait hold up
3 refreshes later and it showed up
I know it can take some time for sessions to pop up.
any tips for prolonging the server uptime? would it be memory leak thats causing server to lag after a week of being online?
I think itās good to restart them once a week anyways
Something something inaccuracies adding up over time.
Doing a ready up button with some ready text above the players head in the lobby. On the character i have a rep notify bool for if theyre ready or not. I want to change the ready text to red / green above the player. But it is only changing for the owning client. How can i make it so all players can see the updated colour? i have set the widget component to replicate above their head
pretty much just want each player to be able to update every other players text
If the bool is on the character, then the OnRep should be firing on the character changing the boolean on all clients, which the OnRep should then be able to get a reference to the widget associated to that character.
@sinful tree hey, i remember you were telling me a little about having multiple levels permanently loaded and it was called 'shard' something. do you know where i can read about that?
Still having issues with my ready up. So i store a struct on my player controller with name, level and ready up (bool) that is set to replicated. When i press the ready button on the widget, it casts to the player controller and runs a server event to update the struct to change the ready bool. That then casts to the character and runs a client event that casts to the widget and runs an event to update the colour of the ready text.
What am i doing wrong here?
the ready text is a widget component set to replicate above the player
Creating a sharded server environment basically is just launching multiple copies of your game server in some fashion while having some additional means of communication to the client even when moving between the servers, and even communication inbetween the servers themselves. Basically custom networking/server systems and additional systems external to Unreal to manage the servers. I don't have any direct information about it that I could send you.
ok thank you. is that the only method though? i thought i saw something about level streaming before
Player controllers only exist on the owning client and the server and are not replicated to any other clients so probably not the best place.
Ahh thankyou. So i should keep it on the lobby game mode or player itself?
The trouble being is you're running a "Run On Client" event on the character - those only run on the owning client.
It'd be better to just use a variable to replicate the state.
Character or Playerstate, one of the two.
Correct
That way, others that join later will receive the updated variable value as well.
A Playerstate exists for each player controller on all clients, and yes, any variables marked for replication on the playerstate with no additional replication conditions will replicate out to all clients if set on the server.
Yes
Level streaming isn't really the same thing from what I understand. That's more like, you don't need to have a level that's very far away loaded until there's someone that's close, and level streaming can accomodate for that.
ok ty
There's only just these few options.
A) Edit the engine and make your own custom networking for Unreal so it can facilitate multiple worlds that are replicated (which you'd probably have trouble keeping high player counts on)
B) Run multiple servers running different maps that can maintain communication between each other in some other way (ie. some external TCP/UDP server)
C) Skip Unreal's networking system entirely, having some other networking system in control that your clients connect to and then tell your clients what to load and where and display what, effectively coding your own game server from scratch.
One of these is a LOT simpler than the others. š
lol alright, i think ill just do your suggestion then. sounds expensive, but im in no position to code the other options
i mean, im using playfab but there isnt alot of info for my requests
im still trying to just figure out how to allow players to join and leave a level without having to matchmake using it
You will likely need to do some kind of matchmaking to accomplish moving players between levels, matchmaking in this sense mostly being the game server itself finding the servers and determining which one to go to and telling your client to go to it.
Okay got it working finally. Next issue. If someone joins in after someone has already readied up. it doesnt show that
have a repnotify on my ready bool, that then updates the player info and multicasts it so everyone knows its updated, then updates the text color based on that. I thought a rep notify will fire off if someone joins later on with the correct info?
if i dont have that set as a multicast it doesnt seem to work. But more worried about how to fix if someone joins in late i want them to see the correct status of the ready button
Do you know why its not showing correctly if someone joins late though?
pretty much the players join the server, and it shows all 4 players, they press a ready up button and a text (widget) above each players head that says ready changes from red to green
Well
Multicast is wrong
The struct has to be marked as RepNotify and the code from the Multicast has to be in the OnRep function
State should always be RepNotify and never Multicasted
At least as a general rule of thumb
@hollow swallow
rogey ill try change it up a bit, cheers
so i got rid of the struct, im just using the Ready? bool as the rep notify.
It runs but still if they join late they cant see it. is it because of how im trying to run the function in the widget?
i think its the whole set up, i need every other player to run that function when someone joins, not just the player thats joined
should i just make an array for each player that joins and whenever a new person joins it loops through the array and makes them all update their widgets again? probably only going to be max 4 players
Could force it to show by setting bShowMouseCursor to true from the the PlayerController
Could even be a clue to what you should debug and where you should look
yeah?
You are literally looking at it
Still no luck
only the client can see it change now not everyone unless i use that multicast that i was before
the rep notify isnt firing when someone else joins in
@hollow swallow this is in a class that everyone has access to, right?
OnRep should def call
Can you print it on tick and see if they at least get the correct value?
ive put a print string at the end and its not calling for client 2 when they join, even after changing the value on client 1 before
but if i change it whilst they are in, it will notfiy them
values seem correct because if client 1 sets to true, then client 2 joins (he doesnt recieve the print string from the notify going off), if i then set client 1 back to false, client 2 can also see he is still false and recieves the print string
just cant work out why it isnt firing when they first join
are there any norwegians in here?
Can you still confirm on tick?@hollow swallow
rogey will do 2 secs
how can i check the value of the other player though xD
i know how to make it print its own value, just not the others
yeah think its working fine. server is ready up and client 3 isnt. and its printing
Server: False
Server: True
Client 3: False
Client 3: True
so it knows the other one was changed to true before it joined in. but it still doesnt fire the rep notify to run the function to update the text
Fwiw just run your UI code additionally on BeginPlay
Should fix the issue for now
BP OnReps are value changed notifiers more than actual OnReps (as opposed to CPP)
Would I make an array and add each player that connects and then loop through them to all to update their text each time someone joins?
No
Only 4 players so not a long loop
Just do what I suggested
Rogey
Thats only updating the client that joined and they still cant see the client that joined before them
Strange, is the value correct on BeginPlay?
Also why is the WidgetComponent marked as replicated?
was trying everything to get to work xD
So each character has the widget component contraining the text widget above their head, thought maybe it needed to be replicated so when its changed everyone sees it
first image i opened the host, pressed ready, then connected the client, as you can see they arent syncing.
Second image, i pressed ready up on both of them and set them both to ready, and they can see them change instantly from the rep notify
š® just fixed it if i add a 1 second delay on the begin play
There goes my whole afternoon but atleast its working now. Thanks for the help, appreciate it!
how would I make it so a Multicast executes a function on every function except a specific client? Is there any identifiers I can use? an ID?
Can't really. You could loop through client owned actors and broadcast a client rpc to them that way, skipping the one you didn't want to send to.
makes enough sense I guess
I've read that an actor leaving dormancy gets all properties including initial only rereplicated to clients, is that true?
That's not a fix. If the lag gets bigger it will fail again
NetUpdateFrequency is useless if I'm using the push model right?
when I mark a property as dirty, is NetUpdateFrequency taken into account?
I don't want to accept it but you're right. Any other ideas I can look into tomorrow to try resolve it?
I would simplify this to start with. Have absolutely nothing but the call to set the replicated variable on the server. And make the owner of the widget component's tick pass that state in and update the widget on tick. If you find this is working fine, that the state is correct in most all tests. Then you remove the tick call. And move the update to both Beginplay and the OnRep of the struct. If this fails you at least know that your variable is replicating but maybe your OnRep is failing.
Cheers mate, will jave a crack at that tomorrow and see how I go
Hi, question, so I have a weapon I created. This is how im setting the owner. Example: void AFPSCharacter::EquipWeaponOnServer(AWeapon* Weapon) { if (Weapon != nullptr) { Weapon->SetOwner(this); and this works, but chat gpt ( i use chatgpt to learn since I have something to talk to if i get stuck) says I should use this: Weapon->SetOwner(GetController()); // the owner is the controller that's controlling your character
so who is right? does it really matter? When asking it said it really depends on your game but the first option worked for me. It's reasoning was also "In Unreal Engine, this refers to the current instance of the class in which the code is running. So, in your EquipWeaponOnServer method, when you write Weapon->SetOwner(this);, you're making the weapon's owner the AFPSCharacter instance that is calling this method.
But since you're in a multiplayer context, ownership becomes important when dealing with network relevancy and authority. Often in Unreal Engine multiplayer games, the AController (or APlayerController for players) is used as the owner for things the character "owns" or uses, like weapons. This is because the AController is the primary actor associated with a player and is the actor that handles the input and makes decisions.
The GetController() method when called from an APawn or ACharacter will return the AController that is currently possessing the APawn or ACharacter. It's okay to use it in this context because each APawn is possessed by a unique AController (for each player). It doesn't necessarily return the local controller, it returns the controller possessing the pawn.
So you'd probably want to do something like Weapon->SetOwner(GetController()); to set the weapon's owner to the AController that's currently possessing the AFPSCharacter."
Learning from ChatGPT is really a shit idea
You can use "this" just fine because ownership is recursive. The owner of the character while possessed is the controller.
There are a few arguments for and against using the character over the controller. I usually use the pawn/character. You can also use the controller and pass the pawn/character as instigator
It doesn't really make a difference unless you create a situation in which it does indeed make a difference. Something like lifetime of the character could be one. If you need to know the owner of the weapon but the character just got destroyed, you have a nullptr.
Well, it (GPT4) has helped me logical errors and thinking. It doesnt outright give you the answer and sometimes its wrong (like now), but it is better than being stuck for 3 weeks waiting for a response on the forum and can at least point me in the right direction for what I need to do. And thank you, yeah I thought it was wrong thats why I wanted to double check. I did not know this was recursive so i learned something new. Thank you!
I use version 3 for a first idea when solving problems. But I wouldn't "learn" from it. I mainly said one shouldn't learn from it and I stick by that
What happens if gun owner is pawn and pawn changes possession?
Then the new controller would own it?
Or do you mean if the gun owner is a controller and the pawn changes possession?
Like again, one can construct problems if a game has to support certain gameplay features
If you use the controller and you can change the possession of a pawn, then you would need to also update the owner of the weapon
That's a fair point if you have no experience at all, then yes I agree. But I know you cant read minds lol, I was mainly talking about logical errors and getting stuck lol.
Still better to just ask here and be patient. ChatGPT hallucinates about 80% of the responses when it comes to Unreal. GPT4 is slightly better (from what I hear), but still they were not properly trained on it.
Good for general concepts and stuff maybe, but otherwise itāll just send you down the wrong rabbit hole, so often youāll just end up even more stuck š
I mean if you ask for some algorithm for general maths, they are okay. But for gameplay features, just forget about them, lol
The algorithms are also often utter bs
They have a lot of hard to spot logical issues
I'd still rather let stable diffusion create my normal maps than have ChatGPT write my code.
At least number 3 is a lot more inaccurate
Isn't that paid?
IMO ChatGPT is only good for brainstorming
If you trust anything it outputs as true then you'll be in for a surprise.
me
How do you replicate animation montages (like fire weapon) on the "other full body mesh" of your FPS character that has just arms?
You could do it via states.
i noticed playerstate has a scene root. does that mean if i have this mesh capture to show in players inventories, it can physically be placed in viewport of the playerstate so it replicates what their player has equipped?
i had to build unreal engine from source and convert my project to the build of the source
ohh
i had a few drinks
So right now I have characters set to deal damage when they punch an enemy, but only the host is able to ApplyDamage successfully. When I log for the client, logs do in fact come back, but the actual damage done shows up as 0. Only thing I can think of is because ApplyDamage is only called on the server
The Icon on the node signifies that it can only be executed by the server.
How are clients supposed to apply damage then? I tried creating a server rpc but got the same result
Show the code.
You maybe doing something incorrect.
Always share the code when you have an issue.
It helps us help you.
Read the log, it will likely have information as to why
This is my code in C++ for taking damage. It runs when the host is the one dealing the damage, but not the client. TakeDamage is overridden from its parent in the AActor class
Is this to me about the montages?
Yeah.
so I setup a simple client - server RPC in c++ with just a log from the server to test it, If I run the game in the editor with 1 player and set as Play as Client everything seems to work how I would expect, it runs on the server and prints out my debug message from server, but if I set it to 2 player not 1, then I get the two server prints I would expect but also 2 other messages, anybody know whats happening ?
LogTemp: Warning: Server : RunningOnServer
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_TopDownCharacter_C_1. Function Server_Interact will not be processed.
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_TopDownCharacter_C_1. Function Server_Interact will not be processed.
LogTemp: Warning: Server : RunningOnServer
If you play montages based on state onreps, you'll be fine.
I will need to research, not familiar with that. Thx
Doing this right now to no avail...
For a grenade, you might have an "action" state or something. When it is changed to "throw" then you start playing the throw animation when that state is replicated. Or you could just as easily send a multicast rpc.
nvm... I read it wrong actually, you are sending to server first then mc
Is there a better way to update all the players info when someone joins so they see the correct stuff without using a delay?
doesnt have to be a grenade. Example above I am trying to run any anim montage (currenlty death) and see it across clients. Problem is the Mesh_3P never reacts but the 1P will if I run the anim no it.
I am doing a multicast now...that Mesh_3P never plays its montage.
well, I just ran in standalone mode with 2 players and didn't get any of the silly messages about No owning connection for actor BP_TopDownCharacter_C_1., so its literally just a thing that happens when playing in editor it seems
define "loading"
If you're literally just talking about loading the hud class then yes, that's normal.
The gamemode decides on the default hud class. Only the server has a gamemode. Therefore the server must load the hud to tell clients what to use.
That doesn't mean the server is actually spawning a hud for itself or doing anything aside from loading that specific class.
What is a better solution than using a delay on the begin play here? The player lobby info is a rep notify but if i dont have the delay at the start it wont update when someone joins in. With the delay it seems to work fine
There's an event called EventPostLogin on the GameMode which has the new Player Controller reference for whenever a someone joins. You can use that as a starting point to do something on GameState or PlayerState or whatever else.
There's also EventHandleStartingNewPlayer on the GameMode as well.
I think the EventHandleStartingNewPlayer runs first then EventPostLogin is called after they've been assigned a PlayerController.
so I was doing some reading and I read Any network traffic must go through an owning connection which is usually attached to a player controller. is this related to the message I get No owning connection for actor BP_TopDownCharacter_C_1. when running through the editor, but not through standalone, is it because they dont have a controller assigned yet in the PIE but do in standalone windows ? whats strange is that desppite the message the event still works and prints on the server
At the moment the character stores their info, and they have a widget component with the text above their head, they are updating the info on the character begin play. Should they not already have everyones info by then? Or should i store the replicated info on the playerstate instead?
@graceful flame
Well it if you plan on letting them play as other characters it makes more sense to have it on the PlayerState
and if the character actors get destroyed and respawned then you don't have to run that same code again during event begin play
I'm blanking out on something I've done before, the client can set a variable locally prior to joining a server. Where should that be stored if I need to set it on the server once I've joined?
I tried the playerstate but that gets nuked on travel since from the menu I'm doing a hard travel.
š¤ game state?
I would still need to run it as the character itself holds the widget in a component. So even if i store the actual info in the playerstate it would still need to change its widget from that info. But maybe there wouldnt be any delay in getting the correctly updated stuff
Ill try change it to playerstate and hopefully dont break everything š
yea exactly the PlayerState would store that info like their name and score but the character displaying the widget with their name can read it from there
And is the issue at the moment, because its stored on the character, its trying to access that and get the repnotify updated stuff from everyone before the character has actually spawned? So on the playerstate it should have the info a few ms before the character spawns? im not sure what order everything runs in but i assume playerstate then player controller then character?
As far as I know its like this:
- GameInstance -> (standalone) then you may or may not have a GameMode, and GameState but depends on how your game is setup.
- (connect to a server's GameInstance)
- next there's a GameMode and GameState already running on the server which handles the incoming connection and assigns a PlayerController and PlayerState.
Meanwhile your own local GameInstance keeps running the whole time but your main menu's GameMode, GameState, PlayerController and PlayerState are all destroyed.
You get assigned a PlayerController and PlayerState before you possess a character, but if the character is level placed it will run the EventBeginPlay when the server first starts up and once again foreach player that joins until it's assigned a new owner (via possession) other than the server.
If the characters are spawned in and not placed directly on the level then the EventBeginPlay on the character runs before it gets possessed but doesn't run when the server is starting up since it doesn't exist anywhere in the level yet.
EventBeginPlay runs when the character asset is loaded, but EventPossessed runs when a PlayerController is assigned to control it via the server.
Also there's a handy Player Array of PlayerStates that's part of the GameState which is an inherited variable and is automatically updated for you.
You don't even have to cast to your specific GameState š®
Damn this stuffs confusing xD so much to wrap my head around
The compendium is pretty good at explaining things also the Replication video in the pinned messages.
i find it hard to understand what can talk with what. Trying to bind some text to a variable on the game mode at the moment but guessing that aint gonna work haha
GameMode is server only
Yeah i have a countdown on there so its accurate. But i need each player to access that countdown to display on their widgets
There's a diagram in the compendium which takes out all the guess work
well I fixed my issue with this
if (GetController() != NULL) {}
I was running the event on begin play, I guess it fires that event from every instance of that actor, including ones that don't have controller. so I was still getting the expected number of server messages ie 3 messages for 3 players, but also a bunch of messages from the other instances that are not player controlled, or something like that š¤·āāļø
Use GameMode for stuff that define the rules of yoru game as in is this Team Death Match we're playing or is it Capture The Flag, or are we in a race with a start and finish line?
Use GameState for stuff like your timer because its a variable everyone needs access to.
Is there a difference between a client RPC and just a normal function?
yes
Having a dig through it now
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
half of its going over my head but hopefully it helps a bit š
That discord link was weird and went to the wrong spot
And I gave you the answer lol
Server RPC is called from client-server
No you didn't
Server RPC can be called from literally anything
It can be yes, there is literally a table showing you all the possible outcomes
RPC is like this particular client needs to run some code on the server and it "uploads" any input data along with the request. Meanwhile a function is sort of like a custom event that just runs on the blueprint its inside of. But the function can run on either server or client depending on ownership, relevancy, and authority.
But as I said , I answered your question, and gave you a link that explains why its not the same, I dont know what more you want
"Server RPC" isn't a thing.
The server doesn't run a remote procedure though because its already the server. It's the client running code on the server.
what
it's an rpc
it's the client invoking a remote procedure to run on the server
it's literally the definition of an rpc
That's why I said its the client running code on the server
so why did you say "server rpc isn't a thing"
because its run on server
yes, invoked by the client. So it's a procedure, invoked remotely. An RPC.
"remote" doesn't imply remote to the server, it implies remote to the caller
Thats run on client
a server rpc called by a client is not run by a client
thats why they're called Run on Server or Run on Client
"run on server" is a server RPC. "run on client" is a client rpc.
blueprint terminology is bad, the actual underlying code is server/client rpc
I find server rpc and client rpc to be more confusing than run on server or run on client, jeez didn't mean to offend the lurkers lmao
ok I think I understand the original question now, so what you are saying is this IS, just like calling a function on the server ?
that's a client rpc, if called by the server it runs the implementation on the owning client
that was the question, is a client RPC the same as just a function
I don't know if I'd touch anything in NPP right now
but what does "the same" mean
and that ^^ is what I know as a clientRPC
ClientRPCFunction() is calling a function named ClientRPCFunction that happens to trigger some network code that runs a function on a client at some point in the future.
so yes, it's "just" a function
It's very simple what I asked,
Is there a difference between an ACTUAL function and a client RPC besides the fact that the client RPC is an RPC
they're both functions
So what's the point in it
what do you mean what's the point
Lol
are you going to write all the netcode manually to make a client run something?
I know what it does, its not just the same as a server function afaik
The Client RPC part tells the function where it should execute.
That's the difference.
A normal function executes on the client anyways though?
Only if it's called on the client.
the point of a client rpc is that you call it from the server and it executes on a client
if it's only ever going to be called on the client for itself then yes, it's pointless to have a client rpc
Oh, assuming it's called on the server it wouldsend it to every single client except the server. Got it
read the table š
Actually stop typing
dont get mad because you asked a question and got the answer
So i have the countdown variable on the gamestate, then a widget on the character with a binding to the countdown variable. It shows the correct variable at the start, but when the countdown starts it is not updating the text
So I'm confused on how it becomes useful if called on the server
You must be trolling.
...because you want to tell a specific client to do something
not every client
just a specific one
It will work for the host, is it because only the server can see the variable? i thought gamestate replicates to clients and server
the gamestate does, did you replicate that variable?
man literally tried sending me c++ docs before telling me to go read, and gets mad when you link him some docs back, go get fkd
Starting to understand a bit better now the flow of everything. Just preparing my brain to get fried trying to move everything to where it is suppose to be and breaking it all on the way š
you not realise that was a fjoke and I know its not js you f reeeee
if an actor is marked āalways relevantā and multicasts a sound or particle effect, will it have any performance impact for players outside of visual or audible range?
I wanted this link, https://docs.unrealengine.com/5.2/en-US/rpcs-in-unreal-engine/, thats all
understood
whatever the multicast does is going to happen regardless of the player's position, whether it has a performance impact depends on what it's doing.
play particle FX that is setup to cull outside of a certain range? You're still paying for the multicast itself and whatever the cost of spawning the particle fx is, but you're probably not incurring any gpu overhead or much else because it's not rendering.
and the multicast's implementation could ofc just decide to do nothing if the local player is far away
but no, the engine doesn't automatically know that you want to avoid doing things if the local player is far away. You have to implement that yourself or take advantage of specific features that help doing so.
Is it okay to do this? From the gamestate i want to make every connected player open a widget (countdown to start the game) only around max 4 players
yeah, these are culled particle effects and attenuated sounds. I was just worried that players very far away would somehow be impacted by frequent multicasts that they canāt see or hear.
because the game pretty much revolves around this particular actor, but thatās a fair point. I suppose i could reconfigure the sounds and effects to be passed through a different actor
/st\
It's not the best thing to do. You could just have a boolean with an OnRep.
still having issues with needing to use delays. If i have no delay here it gets the incorrect info. It is a replicated struct on my character, and the character persists the whole time. Im just opening a widget and want it to check a bool from that struct.
Honestly I would replicate a datetime that was a match start time. If it's set (not zero) and not passed the time, then show the widget. All connecting players can see the time.
i still want to work out how to resolve this though as this is now the second time ive had to use a delay whilst trying to access that struct. and i will need to constantly get different info from it
this current bit, when you ready up, it turns the ready button green, and text above the players head green, once everyone is ready, it starts a countdown. If someone cancels it, it closes that countdown widget for everyone and goes back to the lobby, the text above everyones head and their own ready button need to access the ready bool to set the colour red / green. With a delay on both, works fine, even if its 0.1 seconds. But if theres no delay its always the default value. But that struct exists the whole time so i dont understand why it cant get that information instantly
if i can understand why then it will help me the further in i get. only on the lobby menu at the moment
Who knows what it is?
I can't join to server with this log
TravelFailure: ClientTravelFailure, Reason for Failure: 'Servers can't open network. URLS'
In the EntryMap, I did Open Level like this! always there was no problem..but now strange..
Oh..I add the open level in the next level too....;;solved..
I have it back on the playerstate now, although the same issue no matter where i put it
If it's a Widget above other players too, then that wouldn't work though, cause you would want to get their PlayerState and not the local one, or?
I'm a bit puzzled why you have so many issues with this. A RepNotify variable on the PlayerState should call the RepNotify when another player joins for all the PlayerStates.
I can't repro this at the moment cause I'm not in reach of UE until Sunday/Monday. @hollow swallow
It almost must be something you are doing that you aren't considering important for this problem and thus haven't shared it yet or so. Hmm.
And if the RepNotify doesn't call, for whatever reason, then the Data must at least be valid on BeginPlay of the PlayerState which also calls once the instance replicated to the new player.
I also saw you talked about some other issue in #blueprint . Is that related?
Thanks for the reply, Have tristan having a look through and we still cant solve it either. The other problem is pretty much the same, it cant access the variable on the playerstate properly. Yeah the widget is on each player, so i want them to get their information, and update their widget so everyone can see their name above their heads etc
ive tried looking at some videos of like health bars etc as its the same concept really
The variable is on the PlayerState and the Widget on the Character... Hm. Do you account for the fact that the Character and the PlayerState can replicate in different order?
I havent no
For Clients there is no guarantee that the Character or the PlayerState replicate first
ive tried having the variable on the character, the controller, the playerstate and its the same issue everywhere
Hm
so even when it was on the character it didnt make any sense
Yeah it's also not character data so that shouldn't be the answer anyway
should be such a simple thing to do and ive been stuck on it for wayyyy too long hahah š might just delete everything and start it over
I mean fwiw you could for now just bind the value. How are you setting the PlayerState variable inside the Widget?
im passing it through, so theres an update function on my character, he casts to the playerstate, gets the info then passes it through to the widget function to change the text
Cause BPs have no access to OnRep_PlayerState
Ah
When is that update function called?
begin play
and also whenever someone joins, it loops each player and runs it again
and its giving very odd results, client 1 can see all 4, client 2 3 and 4 see random peoples
sometimes not even their own
Yeah cause replication takes time
if i add a delay it gets better but it needs to be 2 seconds +
You have no access to CPP?
nah havent touched it yet
Hmpf
@dull lance only if you can properly bind to that delegate
The race condition is a pain in BPs
even if i close the widget and recreate it, sometimes it cant access the playerstate info which would have been up and running for ages
It's a Widget for other players. There is no PlayerController for those
if i set it up on the construct of the widget
is the player state always started before the character?
The usual setup for this would be:
In the Character, on OnRep_PlayerState, notify the Widget(Component) about the new PlayerState (if valid).
In the Widget, bind to some OnPlayerInfoChanged delegate that you would create in the PlayerState and broadcast in an OnRep_PlayerInfo function (given PlayerInfo is marked as RepNotify).
Additionally in the Widget you would get the current PlayerInfo once when binding to get the current info in case the OnRep already called with new info before you bound.
The only thing you are missing due to BP is the OnRep_PlayerState function that natively exists in Pawns/Characters
You could make your own but that's pretty yucky
being its a lobby and the characters dont move. Should i just make each client make their own widgets for each player?
This wouldn't really change your problem
is that more simple then having each character display their own widget?
dang
or i just make it update on a loop every .2 seconds xD
One issue here is that you have two actors that need to both be valid etc. But you said the issue even exists when moving the data to the character
yeah was the same with data on the character
I'm still sure there is something odd going on that we don't know about.
looking at health bar above player videos it should be pretty much the same thing and straight forward but its just not
Cause having the data in the character and having it notify the Widget on OnRep should work
yeah thats why im tempted to just wipe the lot and re do it
ive tried changing it up so many times now im starting to get confused following the flow
I would suggest you try this once more in a fresh project with a minimal setup
this pretty much is a fresh project
theres a host / join game menu, and the lobby menu, thats it
But you gotta say that that's a very involved workaround for something that takes 2 minutes to setup usually
I mean fwiw they could just make a second PlayerState variable in the Character, mark it as RepNotify and set it to a value when Possessed calls.
And use that new OnRep to do what I wrote
Not pretty but less involved and the data stays in the PlayerState just fine
why cant it just be easy š store it in the player state, and when i want that data, give me the damn data hahaha
Epic even wrote some init system for Lyra to have some events when everything is ready. But yeah
Would be nice to have some system where one could write some requirements for a function to call and register that someone. And then fulfill these requirements in other places. Probably something with GameplayTags or so.
the lyra init system they added in 5.1 is a godsend
We also got a plugin internally that just exposes all those functions that CPP have natively to BPs. Like the OnRep_PlayerState.
Just put this in the game mode, and it prints the names fine. If its valid then, it should 100% be valid when the character spawns then creates their widget
Just for convenience in BPs.
Well no. The Character can spawn on the Client before the PlayerState does
err, maybe it was 5.2
are you talking about init states or the old thing
the init state system is great
oh, yeah, that stuff is great
nothing really relies on it, it's a completely optional system
and if you have a bunch of interdependent components it's incredibly useful
Man, am I happy to not use Lyra as a base for projects š
the pawn extension stuff does, yeah, but that's because it's a bunch of interdependent components. game feature actions don't.
the stuff they had before init states was way worse
a bunch of manually triggered events on the pawn ext component was what it used to be, and it was painfully hard to follow the order of what had to be initialized when
now you just bind to "i want the pawn ext component to be in this state" and it just works
In that case on the character can I make a function that casts to the player state and fails it repeats it every .1 seconds until it works and then create my widgets? Or is that terrible for performance?
pawnext's init is really delicate in general
it kind of sucks
it's not the fault of the init system though
the init system is really simple and a useful framework, it also isn't tied to pawnext
if you screw up pawnext's init in any way everything breaks so yeah, it's really delicate and not well designed.
That's terrible in general. But it's not like you have a lot of options with that missing OnRep
yeah im very new to unreal so just trying to think of a way i can make sure the playerstate is valid before it starts everything
š
I don't like the idea of moving the data into another component. There is a lot more going on with PlayerStates than data
i mean my pc is a beast it will be fine... as for my friends, thats a them problem when they play š
yeah its a hack job for sure
So
This is also not a nice solution
But you could for now set a Character variable on the Widget
On BeginPlay of the Character
ill keep googling see if i can work out how to make my own initialize thingo so that everything is up and ready before i start doing anything
And then in the Widget you create a binding (ugly) and simply check the character and its PlayerState for being valid before accessing the value you need
That's a tick poll but at least you can keep your stuff in the PlayerState
Yeah thats true. I feel like its something wrong somewhere though as even when i had it in the player it had issues. And that would always be valid when the widget gets made
Dont roast me too hard š
with 4 clients fails around 15 times total before it works for them all xD
So I asked this earlier and was told game instance or gamestate but let me add more context:
I have a checkbox on a widget prior to connecting to a server and I need to set that variable on the server after you join because it'll be used to verify if you are authorized to do certain actions compared to the rest of the people who join.
GI doesn't work because it keeps it locally only and the server will check if they are allowed to perform certain actions based on this variable.
You would have to store it on the game instance if you want a variable to be set on a client before they're connected to the server. You would then have to RPC it through a client owned actor like their player controller, character or playerstate once they've connected.
My repnotify calls my widget to update, yet its still behind. I change the value of the lobby info, then the on rep updates the widgets, but its always out of sync. waduuuu
it only fires the event once that variable has been changed, so how can it not see the change
and just like that, i discovered net update frequency
Not the prettiest but after 8 hours i finally have it working semi nicely. Thanks for all the help everyone!
Hello. I'm trying to test my game in standalone. Like half an hour ago when I first started testing tin standalone I was able to host a game and see the game on the other standalone and join. However, since then I have not been able to find any hosted games anymore. Anyone know what could be causing this? I have restarted the editor, restarted steam, nothing seems to fix this. š¦
I have also not changed a single line or node of code, it just suddenly stopped working
I normally test as client, then in my menus make 1 host and the others can see it and join
Yeah but i'm trying to test seamless travel which doesnt work in PIE
normally I also use that method for testing
When I read this, my initial thought is, why are you trusting a check box from the client for server sided authorisation.
is that just a random statement or were you meant to tag somebody
Sounds good, you should include a part about how the client shouldnāt authorise what the server can authorise. I think it might be of use š
Read what I responded to above
most likely. I am actually really interested in the context of what they are doing tho. A client checks a box, and then that is passed to the server to authorise what actions they can perform. I need to know more haha
guys can i use ponPostLogin event when i use servertravel seamless?
This isn't ChatGPT stuff or?
@uneven dock
Clients have no GameMode when connected
It uses the GameMode that is setup for your project/map/etc.
So it's not training it or so? Cause I would much appreciate it if people would ask me if they can use my stuff first.
Doesn't mean I automatically allow people to train their AI with it
That's false and one of the main problems people have with AI peeps
I would never set things up this way but its the way the client wants the setup to be 
Getting some crazy corrections on my character on UE 5.2. It's not doing anything fancy, it's an ALS community character with a very simple GAS component and 4 abilities.
Using network emulation on the average preset for both ways.
Is anybody else experiencing this?
Yes ALS is basically just a more advanced character (replicated) built on top of the Character movement component, is it that bad? This character is supposed to be made for replication
And I must say, I tested it with some friends, none of them said anything even though we surely had around 100ms latency since they're in Italy and I'm in Sweden.
It seems to be especially bad with the network simulation in editor
One thing that is crazy to me is that montages are getting interrupted, and that's stopping my notifystates from executing fully
sorry, replying here for notification, forgot to do it before
These ones. I'm running each process separately
So total latency on client is 180 from stat net
I'm starting thinking it's caused by background cpu usage on the editor. Even though that's supposed to be disabled, I see it throttling to something close to 15 fps when PIE is on
Might be because of the process Run Under One Process being false (need that to debug GAS)
I am facing this issue, where I have a component, which has this function to send Component Owner Transform to the Server :
void Server_SendTransform(FBPVRPosRepNoScale NewTransform);```
For some Reason, if i call the above function, as soon as i can , eg: on Begin Play. It does not work.
but if i wait for 1 second then send on BeginPlay then it works.
I think the issue is, you cannot RPC to server, unless actor is owned by Owning Client.
but i also check this before sending the RPC, and it returns true.
Anyone know what is wrong with this ?
```return MyOwner->HasLocalNetOwner();```
how can i check for an Actor or Component, that i can send RPC to server ?
can someone please help? I am using seamless travel and noticed items places on my map are failing to spawn before the player comes in