#multiplayer
1 messages · Page 699 of 1
If you want, you can play my mmo on unity
it is online right now
anyway, thank you for your response
https://www.youtube.com/watch?v=rYFXzNh2nwk this is online too and made by me in unity
Hey guys, i'm currently testing with steam and andvanced session, but the client has this stuttering movements, anyone knows why? ^^ Ping was 9999 tho, makes a bit of no sense
Hi guys, any tips for replicating physical objects that get thrown around? what would be the best approach
Define thrown around? Do you need any sort of prediction or is server authoritative movement fine?
You can just replicate the physics movement, tune it in project settings under "Physic Replication Settings" yes it's a typo but that's what it is.
@dark edge I would say something like in the game portal where u pick up an object and launch it
Not sure about prediction but I want clients to see the same thing
I guess I could replicate the movement but would it be too heavy if there are like 20 physic objects in the map?
Nah that's nothing.
Idk, go test it. You can set the replication rate yourself.
Which setting would that be? Sry first day doing multiplayer
If it's your first day doing multiplayer I 100% cannot recommend trying to do multiplayer with physics.
Also the server side sees jitter, I change some setting and make it better but still not smooth as client to client. I suppose this are common problem?
I'm assuming you are using a character that uses the character movement controller? So you have kinematic movement but also physics involved? That sounds like a nightmare
That's prolly kinematic. I'd reconsider using physics unless your game is centered on physics and just treat things as projectiles instead.
Yup that's what I want, a projectile
Prefer if it behaves like a physict object tho
The ghost would be throwing things around the map
This sounds like a absolute pain in the ass to get working smoothly in a multiplayer setting, good luck
Kay, thx for the answers
Oh btw do u know what I can tap to fix the jitter issue on server side?
Client to client sees everything fine
Not without knowing how you are picking up the objects.
Not the objects it's the player movement
... but not the other way around. There are already several Answerhub entries adressing the same problem, but none of them offers a solution. https://answers.unrealengine.com/questions/273179/visual-lag-for-host-on-listen-server.html https://answers.unrealengine.com/questions/225701/client-movement-appears-to-stutter-from-the-perspe.html htt...
Oh no clue, I'd ask in the ALS forums. You're saying everybody sees everybody else butter smooth except for the host?
You aren't replicating input, correct? You are just applying it to the movement system locally and letting it handle the replication?
The problem isn't limited to ALS, even the default TPS suffer the same issue
I've never noticed it, does it happen in a bone stock template project?
I will check now
it has something to do with FPS too
3 votes and 18 comments so far on Reddit
Yup it's the same thing
U can just start from Third person template. Launch as listen server with 3 players. Then watch movement on every window. Clearly client to client side is smooth while listen server sees jittering
this has been a common problem in multiplayer for soo many years without a lot of people addressing it. Kinda what dissuade me to work on MP before, but i just hope dedicated server fix this issue (maybe that way the player 0 doesn;'t have to play as listen server)
We've never noticed it but we also only ever test by launching. Might be a pie thing
Launching is just right clicking the uproject file and clicking launch. Or even faster making a bat file and using that.
Packaging, based on your team and project might be done over night by a build machine (:
The ListenServwr jitter issue is annoying. I looked at it in the past but couldn't figure it out either. Only thing I always change is the ticking of the pose through net updates. Idk what solution I did in the end...
I gathered some notes here in the past from an analysis a slackers user did
ofc I couldn't verify this myself, but maybe this enlightens the situation
Hi Adding Statitc Mesh Instances with an rpc seems to be working fine on both client and*server
However
Removing instances
with onrep or multicast
isnt being shown on clients
only the server can see the changes
those onreps and multicasts are all being fired on server btw
Any ideas on how I can get the client to see the changes?
\
If i print out the changed values from the client
they are all seemingly correct
its just the client cant see the physical changes
Hey, does anyone know what's the best way to have a spectator pawn that you can fly around with?
Do I have to use the floating pawn? Since the spectator pawn doesn't seem to only let your focus on other players
You can just make your own
Set actor location on tick, location+momentum*worlddelta
But floating pawn should be fine too
Just remember that all non characters don’t come with proper server correspondence, so the server won’t know where you are by default, which means other actors won’t properly net distance cull
Without a solution
What object is this on
There are lots of little problems with your setup, removal of indeces can cause 1000 problems in multiplayer
Also, the multicast is sending clients a reference to the ISM that I suspect is not valid because instanced static mesh probably isn’t replicated
I have a lot of experience with replicated ISM crap, it requires some unusual approaches
Like setting scale to 0 instead of deleting
PM me for more follow up
What's in your opinions the best way to manage a project so you can build it for Steam on PC and for non-steam on Android (since having Steam online subsystem makes it unable to build for Android)?
Is it possible to make PreLogin async to check for credentials on database first?
Is setting the player pawn to spectator until auth accept him the right way on unreal?
Don't have to give them any pawn unless you want to. You can set in the game mode none for default pawn, and then spawn in the appropriate pawn and have the controller possess it when you want.
Would I need to split it into two different projects? Is there a way to tell the build process to include or exclude Steam OSS when i build? Or do I have to have that in place or not when compiling the project rather than building the app it makes?
You can use #ifdef in c++
Search for conditional compilation
When doing multiplayer tests in the editor, the state of the game seems to shift when I enter simulation mode. Why is that exactly? Is the simulation acting as a client or something?
Question: if you call a function from within a server rpc, does the function called also only get ran on the server? If the method is being called by using a passed in actor reference and that reference is being used to call the function does the role of that actor matter, and if so what ways does it matter?
The actor pointer you pass gets compressed into a NetID and uncompressed on the other side of the RPC before the function call. This only works for replicated actors. Once you are in the body of the ServerRPC, you're on the server machine.
Generally passing a pointer that gets resolved into a NetID and back into a pointer is safe for client to server. You have to be careful with this for server to client though as the RPC can reach the client before the object has a chance to replicate there, leaving your pointer null on the client.
As for the role of the actor mattering. Not really. You sent an actor pointer from client to server. It's role on the client is irrelevant as long as it is a replicated actor.
hey everybody!
i want to set gravity off (extremely preferably only in c++) for only one client, but PlayerHost->GetMovementComponent()->GravityScale = 0 works only on server (and afaik it turns gravity off not only for PlayerHost, but also for all clients) -- how can i turn gravity off only for 1 client and not for anybody else?
Thank you so much! Perfect answer!
Hey, has anyone used Keycloak or something similar for login? I was planning to use Amazon Cognito but not being able to export users gonna be a problem in the future.
Do you want to desync server and client position?
i want client be able to walk on the air while server will still walk on the ground -- they will both see each other the way they actually exist in world -- client in the air, server on the ground
CMC does not allow that type of movement
It does.
not really walk, but i just want to disable gravity (i'm implementing wallriding and when you are attached to the wall you don't wanna fall but you kinda stick to it and your Velocity.Z = 0)
Movement Mode flying.
I didnt understand if client wants to be somewhere else while server seeing it in somewhere at first reading, sorry
I hit the language barrier on the last sentence
thanks, but it still only sets server flying, client is still affected by gravity
Try sending a server RPC
if (!HasAuthority())
{
Server_SetFlying());
}
and let server_setflying call that setmovementmode
If a game running on a dedicated server has to send half the players of a session to a new level and the other half back to the main menu how can the session remain for the half still playing if the main menu calls Destroy session during event beginplay? Is that possible?
or will the entire session end for all players?
Use case is winning team moves on to a new level and losing team gets booted back out to main menu.
im sorry maybe its dumb question but:
i couldnt find server_movementmode in https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/GameFramework/UCharacterMovementComponent/ and in rider (because they are the same obviously)
CharacterMovementComponent handles movement logic for the associated Character owner.
You need to declare that yourself
Tbh I didn't dive into movement modes too much, maybe CMC has its own function to call some RPCs for you but if it it doesnt, you just need to create a Server function and call it if you are client
UFUNCTION(Server, Reliable)
void Server_SetZeroGravity();
thank you very much!!!
it worked 🍺
The players that you, destroy session on, are ending their session. So the session will continue for the others still connected to session.
im trying to do name tags but it is just not working
The host can see the names but every name is the same and the people that join cant see the names
(for the ui)
Hey, is there a way to make sure SET w/ Notify's callbacks get called like a reliable multicast event?
Or should I just convert it to a reliable multicast event? seems kinda unnecessary because it's doing all the calculations needed for setting that variable, however I need to make sure all the OnSet callbacks get called, (So I won't miss one if it's quickly Set to something else before it replicates...)
#if UE_SERVER
You're using GetPlayerCharacter0 here.
In beginplay. Which is ran on both server and client, and setting a replicated property.
Same difference. Different actor.
i dont understand
GetPlayerController returns the local controller on a client. On a server it returns the first player that joined the server.
ohh
its fine now anyway i just removed it, it got too distracting well playing because the names are pretty big
so i just added a death thingy in the corner that show when a person is killed
Also, how come you're not using Playerstate's name?
who killed them and what gun
i like to make it easy for me to understand so i just use player name variable that is just a string that is set to the persons steam username
That's all the player state's is. Pawns and controllers have access to their relative playerstate as well.
Fair enough. 😄
What role have AI controlled entities? I'm unsure rn... is it authority? or...
AI controllers don't exist on clients.
Oh, controlled. As in the pawn itself?
For the pawn, same as any other actor. Server has authority, as that's the machine that "spawned" it. Clients version would be a simulated proxy.
Unless you're spawning it on the client specifically for some reason, then it'd have authority on the client and no other role anywhere else.
o-o Alrighty
So I'm currently trying to replicate pawn movement it's working in bp but not in cpp
// Called every frame
void AAmbienceCorePawn::Tick(float DeltaTime)
{
ActorDeltaTime = DeltaTime;
Super::Tick(DeltaTime);
if(!HasAuthority())
{
Server_SetLocation(GetActorLocation());
}
}
void AAmbienceCorePawn::Server_SetLocation_Implementation(FVector NewServerLocation)
{
if(UKismetMathLibrary::Vector_Distance(NewServerLocation, GetActorLocation()) > 15)
{
Client_SetLocation(GetActorLocation());
}
else
{
Location = NewServerLocation;
}
}
void AAmbienceCorePawn::OnRep_Location()
{
SetActorLocation(UKismetMathLibrary::VInterpTo(GetActorLocation(), Location, ActorDeltaTime, 15));
}
void AAmbienceCorePawn::Client_SetLocation_Implementation(FVector NewClientLocation)
{
SetActorLocation(NewClientLocation);
}
Any guesses?
Not sure. Don't see anything actually moving it on the server. If it is moving on the server from something else, then I'd assume that it's not replicated somehow. Also worth noting that your current setup can be achieved with just checking the replicates movement checkbox.
but it's a pawn and clients can't move by default
it even says here :o
But you're right I got confused a little I'm only setting the location OnRep which would mean on clients
can i use stream level bounds volume only for map visibility?
I'm creating a multiplayer game
I would prefer the map to be always loaded
and only visible when a player enters a field
won't such a practice hurt in multiplayer?
?
and can anyone tell me what to look for when using streaming level in a multiplayer game?
🍑 Got a Problem. In Multiplayer i have items liek a Teddy- if in a 2 Playermatch a Player takes it sometimes it goes to another player and not to the Player who picked it up. Is there a way to get just the Plaayer who is picking it up and avoid teleoprting items to other players simple?
i check the Parentplayer from the 4 players who are childs if he owns alreaddy the item or is holding one too
I don't get why you're using two events to implement this functionality. Event Interact should be enough with the Instigator as the player who did pickup the thing.
Yes i hooked after the delay it also i. The cast to assault… but happens too
The overlap is for open the Gate to pick it up
This cracks my game totally
I call this code in the item… btw
And it’s replicated
You really shouldn't need an overlap check.
You're probably doing a line trace as it is to determine the actor to perform the interact on - you should be able to calculate the distance of that line trace, and if the player is close enough, then you should allow the interact interface to proceed.
I have the collision also for a fresnel so it glows when the player is closer
But also when i hooke the fresnel and gate logic out it happens
Well, as it stands, you can't do this. Any time another person overlaps, it breaks who the interact is really from so your cast is only ever fed the last person that overlaps.
Oh?
Also, you need to separate logic from clients and server on overlap events. When a player overlaps, that event is triggered on the clients and the server. You can use a "Has authority" switch to determine if you're running on the server or on a client machine.
Does has authority work to with 4 players?
So 1 Server 3 clients
The event interact repliates aswell unfortunately
Sure but you need to understand that "has authority -> server" means it'll trigger on the host of the game. "has authority -> remote" will trigger on the clients that also detect the overlap.
Are you using a dedicated server or a listen-server?
Listen Server
Yeah you need to make sure you run a has authority check as Datura told you.
And use the Remote pin
the remote pin?so if i trz it it doen picks up on server or client... and i need to sedn to the player who picks it up sever things, like show the item in hand, set bollean to true if he owns now the item ect
ok i understadn but if they are 4 players will the remote pind wont cont for the 3 of them?
Switch has authority has to be on the overlap event
@fathom aspen
@sinful tree i also changed the pin from cast to to the INSTIGATOR of the Event Ineract
it goes now trough also as server maybe thats the sulotion? cant always replicate the teleporting error but this time it dint happen
Interaction should follow along something like:
Player presses "Interact" button > sphere or line trace from player's location to (camera's forward vector * interact max distance) > If there is a hit actor call a "Run On Server" interact event that passes the actor from the hit event of the line trace > Server verifies passed in actor is within interact range > Calls Interact Interface on the Actor
Actor with Interface > Does whatever it needs to do as it's running on the server.
Overlap Event (if it's something visual for the player overlapping) should not have anything to do with the interact interface. Doing something visual with the overlap is getting a bit more complicated as you would also want your host (the authority) to see the visuals as well I imagine, but you only want the visuals to appear on the machine that is currently overlapping. To do this, I think you could cast the "Other Actor" to Pawn (or whatever character if you intend on doing something with it) and do "is locally controlled" and if true, change the visuals. Same with the OnOverlapEnd event - you'd want to check only if it's the local player that's ended the overlap.
ok i seperated nw the interatlogic with the Sphere collision seems to work?
What is the console command for adding latency? Google lead me to "net PktLag" but this option doesn't come up in my list of console commands (nvm found it, it's NetEmulation.PktLag)
I have two parent characters in my multiplayer game. Is it normal for the character blueprints to have hard references to the PlayerController, the PlayerState, and GameState? Am I doing this right or am I creating too many references? I can't seem to figure out how else to get all that data to reach them. I'm mostly calling the state I need and then firing off a custom event, I'm using some event dispatchers as well.
Should I be refactoring into using more interfaces?
I'm using each reference more than once to get and/or set data according to some condition.
Is it best practice when developing a multiplayer game to NEVER use casting to make references between the GameMode, GameState, PlayerState, PlayerController and Characters?
There is nothing like that to "NEVER" use casting to get all these game framework classes.
If you feel like you're having too many casts going around then you should consider using interfaces instead.
Well I'm always storing whatever I casted to as a variable and use it more than once.
That's ok. You're using the same variable.
Like does it make sense to make an interface between the playerstate and gamestate that only gets called twice per session?
It's more like a preference question. But my answer would be no.
ahh okay
It's been working alright so far, but I think it would be better for performance to refactor away all these references into interfaces whenever possible.
But that would mean creating lots of interfaces, which I guess is okay...?
You don't gain any performance doing this refactoring or at least it's not a significant factor as you think it is
It's more of a design issue
I think I understand it a bit better now, its only "bad" if a reference is made but never called. Then I'm wasting memory, is that correct?
ye
For example, something is casting to something else then sorted as a object reference variable but never gets used once during the session because of the current GameMode.
Yes sure
Thanks for verifying this for me
How do i replicate an array (List of Items) only when player open stash or talk to vendor?
Do i need replication graph for it?
No. You can either use custom conditional replication, or the simpler solution - just use an RPC to send the data over when it's needed if it isn't being constantly updated.
i`m doing this
i have an ItemContainerComponent, it is on character (inventory) and on stash (StashItems)
But on vendor it is possible for many players open the same vendor at same time (and they need to see the items sold in realtime)
Is it a good idea to have a list of interest actors inside the component?
i would use a FastArraySerializer
you can use network relevancy https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/Actors/Relevancy/
(if the whole component is only relevant at specific times to specific people)
much simpler than handling this stuff all through rpc's (and RPC's won't work on NPC's).
i need to use maps because i need to maintain itemId (or for arrays, array index if you remove from center)
{
return WorldInventory.ReplicatedEntries.ContainsByPredicate([Guid](const FKaosItemEntry& Other) { return Other.ItemGuid == Guid; });
}```
you don't need maps
If you remove the first item of array it will change the index of all
right but item should not care where it is
item location is only determined locally
even if the item does know where it is, having a int32 on the item for its location works.
I personally would not use map cause map's can't replicate.
in my game, item's have no idea where they are in the inventory, that is maintained by the say the QuickBar component (game specific).
Do you have item drag & drop from different containers?
how do u know what u are dragging on
yes
cause the widget holds the info about the item
struct FKaosSlotEntry
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadOnly)
FGuid Item;
UPROPERTY()
bool bEnabled = true;
};```
and i need to maintain itemId on the EquipmentsContainer
0 = weapon
1 = shield
2 = pants
etc
cant have holes
cant move pants to 1 if i remove shield
I see
Hey Kaos, is there any possibility you know about this? If yes, can you share your thoughts after your conversation ends?
<#multiplayer message>
oh i dont fire bullets on the authority, so never encountered that
Did you go full client authoritative? 🤔
yes
with server side checks on the shot data
one thing is, you need to keep the timers in sync with framerates
i assume you set a new timer for each shot?
Yes
But ShooterGame had some logic to keep it synced, they are just not getting executed (breakpoint never hits those lines)
yes
const float SlackTimeThisFrame = FMath::Max(0.0f, (World->TimeSeconds - LastFireTime) - WeaponData.TimeBetweenShots);
if (bAllowAutomaticWeaponCatchup)
{
TimerIntervalAdjustment -= SlackTimeThisFrame;
}
Yeah pretty much same, but this does not prevent it either. So probably I should seek solution in another logic. Thanks for the inputs ❤️
like i said, mine is all client side
not tested with server running the same code
what is liekly happening
is client has finished firing, but the RPC to server has not arrived yet
Yeah, exactly
so server fires an extra shot, cause its not been told to stop
as the rpc takes a while to arrive
I thought ShooterGame was preventing this somehow (as I wrote above) but I realized even ShooterGame's implementation is not able to prevent this
So maybe this can be even unavoidable
Ah, you're right. I confused with my altered implementation. I also fire from server. So probably I shouldn't then
I wrote that logic in my very early days
yeah, if you do server doing the stuff
you kinda don't want to run it on client
though for responsiveness, just let the client handle timings
server can still do the traces (if you want)
just the client signals to do that
Server fires literal actor projectiles so my past self though I need to avoid RPCs because it can cause serious delays and desyncs. Now I'm realizing I need to rethink about the whole system
i have anti-cheat measures, like i check the firerate between shots to make sure its consistent on the server, angle to the shot, simple line trace to ensure the shot could hit not what was hit, etc
and a few more secret ones 😛
Is there a way to get all current actors in the owing frustrum?
You mean actors in the camera view?
Yes. I know of one way by converting the actor’s location to screen space but it’s expensive. I was wondering if there was a lower level abstraction already built in.
not really no
What about this?
that's still doing calcs under the hood
There this answer by Rama but it iterates over all actors. Don't think that's ideal
Hyperlink intensifies
Hello! I can't find a way to do what I want... Well, the situation: I have a topdown camera layout in my game, so some objects are hidden by other objects (basically, because they are behind other objects) - and that is totally understandable. What I want - is to get somehow a list of these objects which the camera can't see at this exact po...
becareful with that though
i had bad results (might be ok in FPS games, but breaks in top down games, etc)
also it works from bounds, so if an actors bounds is huge, it could be rendered, but not actually in the viewport
Cool edge case right there
Widgets in multiplayer are only locally relevant right? I'm working on setting up video chat on a quest and running into a small issue. The user is joining the channel (audio works both directions so we know it's connected) but the video image isn't being delivered to the widget. In agora this is done by binding an image to a delegate and then setting the image brush with the delivered texture each time it's updated. This works in single player, so I know the setup itself functions. There must be something off in the way I have the function filtered.
We have an actor in the level that functions as a 'video booth'. When the user steps into that booth, the user is connected to the video chat channel and a widget is display that has the remote (desktop user) video displayed. Logic works like this:
When the player character (default motioncontrollerpawn from the epic template) overlaps the video booth we check for the following:
- it's a motioncontrollerpawn
- and the pawn is locally controlled
This should (unless I'm mistaken) mean that any code that executes after this is being run on the client who stepped into the video booth.
At this point we tell the pawn to request an open video channel name from the server, set the widget visible, and then we tell the widget to activate. Activate means going to the local users game instance, getting the reference to the local agora object, and binding that texture. We know agora is working because the audio works, and I know this works in theory because this works in a non-multiplayer environment.
All I'm seeing though is a white box where the video image should be when connected to our dedicated server. The widget, nor the video booth actor are replicated. it's not necessary here. So I'm not sure why I'm getting a white box.
I'm using GAS abilities to play an animation montage, it seems to only be replicated from Client->Server. The default mannequin movement animations seem to replicate fine. Here's a vid example
Any ideas what I might of missed?
for a bit more context, everything else about the ability is replicated fine
are you using the task playmontageandwait?
that's the main way to replicate montages with GAS abilities
you can extend it if you want
#gameplay-ability-system @crude quail
hi
so i made multiplayer, but when i shoot only i can see the projectile and the other cant see it
@green garden gotta replicate it to clients I guess
I'm trying to setup steam multiplayer connection, but my steam overlay doesn't switch on when running the game? How do I fix this. I already changed the defaultengine
omg.... turns out I disabled steam overlay to reduce lag in Elden ring
I renew the question
You can do this per-game is steam fyi
how can figure out the server func done it's job ?
i write Server func on cpp and on bp call it. in bp flow don't wait for server func to finish his job and go to next step.
i want to wait for server to finish his job
how can i do it?
You have to have the server fire a reliable Client RPC to confirm to the client
And then (which may be one second later) resume your logic
it is reliable
i sync my player info like lvl on server
in replicate var
then
i wanna show it
but in client
don't wait for server done its job
and show older info
my eng not good if u not understand me sry
i want to wait for server to finish his job
You need the server to send a replicated event to the client to tell it that the server is done.
Simple stuff
i know but we havn't any other way ?
i see steam do a nice job
There is no other way, no
for example when u want get steam id from bp,
in steam plugin have 2 exec
one of them have delay on complete
how they do that?
Look at the source code for it
do u know what is this ?
https://docs.unrealengine.com/4.27/en-US/BlueprintAPI/Ability/Tasks/WaitNetSync/
Wait Net Sync
I've given you a simple solution, this might be the basis for another
Same thing essentially anyway
So.. I discovered over the weekend that netpriority does more then just effect bandwidth of actors, it also seems to change the initialization order of actors that are sent in one go.. It seems very consistent even over the internet, and simulations to drop packets but I cant find anywhere this is documented, only things I've found about netpriority just talk about 'bandwidth' and nothing about the order. Anyone know of any reference about this? otherwise I'm going to have to dig over the source code to just be 100% sure this is safe.
Any code that depends on actors being initialized in a certain order will inherently be prone to error. All I would say is don't rely on NetPriority to enforce that.
I imagine that Epic would consider this something of an implementation detail and nothing you should rely on, same thing with property replication order.
E.g, properties will replicate in the order you define them in GetLifetimeReplicatedProps - but you shouldn't actually write code dependant on that.
Is there any difference between replicating a tsubclassof and default object?
Hi, when I "play in viewport" with 2 players, everything works fine but when I play with 3 players, my UE 4.26 crashes and shows this error :
Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/CoreUObject/Private/Templates/Casts.cpp] [Line: 10] Cast of IpConnection /Engine/Transient.IpConnection_6 to LocalPlayer failed
Do you know why this is doing that ? thanks
hey guys, hope everyone's day is going great 💙 I wanted to ask if there is a way to prevent the Controller's Pawn from being destroyed on Logout? Thanks!
If I'm not mistaken, you can override PlayerController's PawnLeavingGame.
😮 awesome! thanks dude 💙
Hi! does anyone know if there's a way to know when an actor has finished spawning?
I have one method where i spawn a few actors and i don't want it to continue until those are fully spawned
What does fully spawning entail?
When a mommy actor and daddy actor love each other VERY much....
Hair on the bottom, according to law
I'm getting some times the following error "actor xxx is not fully spawned" so i guess that there's some notion of fully spawned for UE4
It probably means you used deferred spawning and didn't call "FinishSpawning"
Wait I thought that's how you get Child Classes
Hi all, sooo multiplayer's a cunt lol ive been learning more about replication and the server-client relationship and all that good stuff and from what I can gather I've pretty much wrote everything in the 'wrong' way, although I'm still getting the desired behaviour I think I'm over complicating things for no reason, in the below example ive got code for a door, old way on the left, new way on the right, (ignoring the has authority check for now but I do wanna touch on that) am I now writing this in the best way or can i even improve it further? Would really appreciate the feedback so i can start getting this right lol
@blazing sprucev3 will be using OnRep
If someone's out of replication range or late joins, they might see the door closed when it should be open as they missed the event
use state whenever possible instead of events
your v2 is close, you don't need the open and close events to be replicated
also you can use 1 timeline and just play it forward or backwards
CLIENTSIDE
Interact -> Run on Server Event Interact
SERVERSIDE
RoS Interact -> Set w/ notify DoorBoolean
EVERYWHERE
DoorBoolean Onrep -> call UpdateDoor
UpdateDoor -> branch on DoorBoolean -> Play or Reverse the timeline -> Set Door Angle.
Thanks for this its actually really helpful, so firstly the interact i have on there is through an interface, are you saying I should remove that and set up an RPC for interaction instead or is that where the HasAuthority check comes in... or should i be doing this where the line trace is called for the actual input for interacting?
Thats how ive got it set up atm
The fact that you're trying to interact needs to make it to the server somehow. In our project it goes
Input -> RPC -> Interact Interface
all in the pawn. So the client -> server communication happens between input and the interaction interface call
can call game state server func from widget?
Have you tried?
How would I know, you haven't shown your code.
Are map variable used in blueprints replicated? If I had 1 on the game state class would clients be able to find values? I ask because there is no option for setting a map variable to replicate
Maps can't replicate out of the box
There is a workaround though and it's to use structs
hmm ok ty for the info
Hello, anyone know how to get a response from two clients separately via UMG ?
What do you mean by "seperately"?
UMG is local to each client. It can respond to the client and stuff
@fathom aspen It's like this, I play a cutscene and it stops mid way and asks for each clients input. After getting the inputs of each client I resumes the cutscene. But the cutscene should resume at the same time for each client. Until that the cutscene is being paused
Widget talks to PlayerController or Pawn or PlayerState which talks to server
I was reading through a lot of the source code for the online subsystem steam module and noticed there seems to be no way of using SteamAuth with dedicated servers. What happens is if you have steam auth enabled, you have to also use SteamNetworking() (p2p). The problem with this is that I am unable to connect to my dedicated server when using p2p connectivity. It just connects, and keeps trying and then fails. If I disable SteamAuth then I'm able to connect to the server. However, this obviously has it's own problems. It looks like Epic only implemented steam auth with listen servers lol...
Ok what I would do is notify the PlayerController of the input on widget. Then make the PlayerController send a server rpc to the game state increasing an integer Count property and checking if the count equals the size of PlayerArray
Seems like an #online-subsystems question
Epic's implementation of Steam is wrong.
That could be a thing too
hey folks
i wanna call server func
in game state
from widget
UFUNCTION(BlueprintCallable)
void TestClient();
void UPCSClanWidget::TestClient()
{
Cast<APCSGameState>(GetWorld()->GetGameState())->TestServer();
}
this is in my widget header and cpp
UFUNCTION(Server, Reliable)
void TestServer();
void APCSGameState::TestServer_Implementation()
{
UE_LOG(LogTemp, Warning, TEXT("test server"));
}
and this is in my gamestate
this don't print anything on server
what is wrong?
My projectile spell doesn't perform any of its logic when fired from the client side. Its supposed to explode on impact which works when used from server, but from the client's pawn it just hits someone and stops moving. The server doesn't even see the projectile. The event to fire it is a multicast function from the pawn. The pawn is "owned" by the clients player controller
its logic includes playing an explosion particle effect and calling functions on nearby pawns to deal damage
this is all done inside the projectile blueprint
the event for that is "run on server" which is triggered by onComponentHit
You can't send Server RPCs to an actor you don't "own", this only works for example on actors like the player controller or player character
so should i set the owner of the projectile?
Wasn't an answer to your question. I have no idea what you are doing wrong as I don't know your code^^
But I think I get your issue. You can send multicast events only from the authoritive actor(I think, but possible you only can send multicast from the server), which usually is on the Server, so what you need to to is: Request to shoot on the server (you may do local prediction) and then the server needs to send the multicast.
yeah i have the "shoot" event as a multicast
So the client sends a request to the server and the server then sends the multicast?
first picture is the character pawn, second is in the controller
so i guess yes, its an input action that calls the "run on server" event in the controller which then calls a multicast event on the pawn
What does "IsProcessing" do, who sets this and where
and if you "guess" why not log it?
isPossessing is set by the controller, it probably doesn't need to be replicated
log it how?
well apparently if i don't have it replicated the client can no longer even cast spells
Why do you need isPossessing? what does it do?
Log: PrintString
my game is similar to chess (eg you have a certain amount of units) and you can possess your units and move them. IsPossessing makes sure you don't use the spell controls and stuff while on the rts style camera
so you have multiple actors?
yeah
i am not sure
could you try using the PlayerState to send the Multicast with the actor you want to call it on as reference?
i haven't been using playerstate.... lemme see
I basically just want to figure out if the issue is on your actor or a different one^^'
i'll have to set up playerstate
i've basically just been using my controller to do anything I thought a playerstate would do
so make an event on the playerstate that the controller calls which then calls the multicast on the pawn right?
no^^
So the PlayerController is only on the server and the client it belongs to. the player state is on each client. So I'd first of all just test if you receive a multicast event on the player state on each client.
Afterwards you can either check whats wrong with your actors or use the player state to distribute the multicast and then on client side just start the logic on the actor
so make a multicast event on the player state and call it from the controller just to see if it works/
yep
what is supposed to happen? i have just a print string there and on the listenserver it says "server: example string" "client1: example string" and on the client it just does "client1: example string"
i just have it hooked up to a keyboard input on the controller
guess that's fine, seems unreal replicated the print also to the server
yeah i'm not sure
I am currently implementing a stance system(standing, crouching, prone), using the CharacterMovementComponent. Currently I am implementing my prone the same way crouch is implemented, meaning I extend SavedMove to accept a flag called bWantsToProne. However, considering the stances really are a state machine of sorts, having both bWantsToProne as well as bWantsToCrouch, feels like a bit of an anti pattern since conceivably we could be in a state that would not be handled by the movement component. I would much rather be able to pass in an Enum, lets say DesiredStance into my SavedMove, read that on the server and then update the new stance on the proxies.
Is there any detriment to passing something into the SavedMove which is not handled by the compressed flags (Like my Enum in this case)? I would much rather use the compressed flags for other things, like Sprinting, Sneaking etc. than wasting 3 of the bits on the stance.
Also, which is the best method to override in the CharacterMovementComponent to intercept the new move on the server?
Grateful for any answers!
Hi guys! Is it possible to convert a FVector to FVector_NetQuantizeNormal, I want to know the compressed value before send it through RPCs!
Thanks, thats how ive got it set up but do you use the HasAuthority node anywhere? when ive been looking at the network features content example project, as well as the project for one of the inside unreal livestreams they did a while back they are using them almost everywhere but im still not entirely sure what exactly they're doing since most of the code works without them being there and it works for both client and server regardless
Hey guys. I think this is the right channel. I've got some local non-replicated widgets that the players drag onto the screen which then activates some replicated visuals to all players. It used to work fine but then at some point it broke for clients. Every time I try to interact with the drag widgets in a client I get this warning and nothing happens. It's not even an error. It still works fine on the server. My very limited research findings says it's something about network serialization, which makes no sense because the widgets are not replicated. It's driving me crazy. Has anyone had a similar issue?
Presumably you're trying to reference them within a network function or replicated property
Is there any way to tell where? This warning is next to useless. I've followed the trail everywhere and it all looks correct.
Somewhere in your game instance, or at least, it's referencing variables from your game instance.
Hi, I would like to show the name and a healthbar above other players in my game. I came up with this solution you can see in the screenshots. I curious if I can simplify this to a somewhat cleaner approach. The main problem is that the player state is not immediately available because of replication. For that I have created the OnRep_PlayerState dispatcher. But this only works for the client (remote authorities) because the playerstate is only available in the server after the character is possessed on the server.
Inside the BPW_PlayerInfo I am listening to the OnRep_PlayerState event but it can also happen that the event is called before the the listener is setuped so this is why I also needed the extra check for isValid on playerState.
This feels like lots of checks in different places just for that "simple" thing. The healthbar with replicated health was much simpler to setup. Is there a more intelligent way of handling this kind of waiting for the playerState?
Usually you'd attach the nameplate to the Pawn, and in Tick you'd fetch the name in Playerstate and set it to the plate
The capsule pretty much has to be vertically aligned. Anything beyond that will involve a lot of modifying the CMC
Ah yes my playerinfo widget is attached to the player character. So it would be totally fine to poll for the playerstate inside the tick function of the umg widget (or using property binding)? I was always somehow afraid to use the tick function 🙂
If this is purely Blueprint, being afraid of Tick is somewhat legitimate
There's indeed a cost attached
If you have C++ access, you can easily override Playerstate's SetName and add a delegate. Otherwise your only choice is tick.
There's indeed no real alternative here
As I usually say - if you need Tick you should not be afraid of it
Also random fun note. Even that function breaks on a Listenserver. Requires a next frame delay to set correctly after the delegate broadcast in some cases, but only on the listenserver itself.
Alright thank you both for your answers! Yes it is Blueprint but I have exposed OnRep_PlayerState from c++ so I might also try your advice @kindred widget. Does this also solves the replication issue so does SetName gets called even if I don't call it by my self and instead constructed from replication?
What do you mean by that?
When I was making my player name widget, I had a delegate in PlayerState. Ran from SetPlayerName and OnRep_PlayerName. For some reason specifically on Listenserver Machines at the time despite the broadcast being at the end of those functions, the widget didn't update name correctly on the listenserver. Not really sure why considering that PlayerNamePrivate should have been set at that point. Ended up with blank names on the server and correct names on clients. Was easily fixed with a 0.0f next frame delay, but weird.
Oh okay thanks for that hint. Maybe I will also come across this weird behavior now I am warned
@kindred widget Sorry one more question regarding the delegate in your playerstate. How have you assigned a listener to that delegate dispatcher when the playerstate is not yet ready?
GameState delegate. Uh..
AddPlayerState runs when a playerstate replicates and adds itself to the GameState's PlayerArray
Alright thank you!
If you initialize your UI with AHUD's Beginplay, you can always count on GameState being ready at that point since it is what causes that to run.
Good place for root delegates for that sort of thing.
Okay nice thanks, I will try that
hey guys
i wanna run server with cmd
and join it by cmd
anybody know what should i do ?
Do player states stick around even when a player is disconnected?
I see there is InactivePlayerStateLifeSpan and I can set that to 0 to have it stick around, but isn't it still a "copy?"
it sticks around for 5 minutes
it takes a little work to get working, depending on the game
and there is one Duplicate() call involved
guys im having this issue where https://gyazo.com/fe01bb7558c162e4dd527d0a85c7badd
my second and extra players dont get spawned at all and the only one that spawns is invisble to other players
i dont even know what im looking for to hopefully find the fix for this
im not even sure what term i should be googling :<
Here you can find examples: https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/CommandLineArguments/
So pointers to old player states won't work when a player disconnects?
not sure without checking the engine code, but pretty sure Duplicate happens if the player reconnects
I need some help with projectiles that do stuff upon impact. Essentially I have it so that the player controller owns a bunch of pawns, these pawns can shoot projectiles which are then owned by that pawn (and therefore owned ultimately by the controller).
The projectile is fired via a multicast from the pawn, but since the owner is the client player controller, i guess this does not work? what is the proper way to deal with this, just have a multicast AFTER a run on server with an authority check to make sure the server does not run twice?
and then how should the logic within the projectile be run, same? on server with a multicast after and authority check to make sure server does not run twice?
any help would be appreciated 😅
Show your gamemode
Your handle starting new player is doing nothing
not sure if that'll break it, but seems like it
@lyric skiffDo you need prediction?
what's the game style
cuz if it's at all close to RTS, this sounds like you should just be doing everything on the server and replicating it
Its kind of a weird game mode i'm designing. Its somewhat RTS but I have possession of your units in thirdperson
I'm trying to make the first person template multiplayer. Usually I just call the fire function on the server but since the weapon is a separate actor in UE5 that no longer works. What can I do now?
i'll need to research what predicted means but right now I have the actual spawning of the projectile as a multicast function from the pawn that is owned by the client so i'm pretty sure that is wrong
You probably need a server rpc with the projectile actor replicated
Yeah that is the easiest, and can work for some games
hell even New World doesn't predict projectiles
I don't think prediction matters as it is a turn based game
oh lmao
maybe i'm wrong about this
if it's turn based then yes server does everything
what the client passes to the server is "Hey I wanna shoot my gun now"
ok ill make some adjustments
thx
Try deleting that event and seeing what happens
thats the goal xD
i get confused cause my brain is pretty smooth so lemme try to understand though. It should all be done on the server but then what is the multicast vs run on server? do i just have to chain those together to make sure everyone sees it?
If you wanna know more about prediction and see live examples, you can check ShooterGame code
If you still need it, you can try calling parent function
Client -> Run on server -> Do thing
no multicast
multicast means "everyone do this"
only server can call it
Multicast is called from server and executes on all clients. Where Server rpc called from client and executes on server
What does a "turn" look like in your design, sorta like Divinity Original Sin?
Yeah sort of, set amount of AP for moving and abilities
yeah, that's super simple to make multiplayer. Much simpler then live action real time stuff
So what you want to be passing to the server is your moves. Move here, use this ability here, etc
Multicast I would probably use it for non gameplay events. For example spawning an effect or something
Yeah maybe but I like to keep stuff state as much as possible.
when I change the event that actually spawns the projectile/ability to "run on server" it doesn't let the client call it at all
Client probably doesn't own what's trying to do the calling
You can set up this whole system in your playercontroller, no need for pawn stuff really. Don't use possession for turn based stuff
The playercontroller just has to have run on server events like MoveCharacter or MoveCurrentCharacter or CurrentCharacterPerformAbility etc
you don't need to do any RPCs inside of characters.
uh huh that kinda makes sense
I wish I had a good turn based idea, it's actually really feasible as a small indie vs trying to make a twitch shooter.
Basically think about how you'd play the game by mail. That's what you should be sending to server.
you can work with me 🙂
like corrospondance chess
lol
Can make a TBS game online with friggin standard HTTP requests, lol
Shit, I have an idea, but I also have like 3 games in front of it 😭
@lyric skiffI would start with a PerformAction struct. The struct would contain a character ref or ID, a ref or ID of the move to perform, and the target tile or cell or location.
Just pass that in a TryPerformMove run on server event
("Bigass McGee", ChargeAttack, (12,3))
That'd be your big boi charging at tile 12,3
I ideally wanted movement in 3D as the character.... i'm really not sure yet if that adds anything to the experience but that was my ideal
full 3D movement like as in the thirdpersoncharacter example project
ok
("Bigass McGee", ChargeAttack, (1231.231, 3021.55, -200.37))
i see
And please, make sure their name is in fact, "Bigass McGee". Or at the very least, be a hidden character.
lemme think about what you've said for a bit
absolutely
That's what all my muscley guys are in games lol. Shirtless and with a big bonk stick.
i mean i think i can still refactor my stuff to be what you're saying
If you're talking about live action movement etc, that would get trickier and probably imply possession unless you like lag.
i just have to move the spellcasting logic from the pawn to the controller
You're talking like XCOM right?
is there anything that would make an actor not set to replicate replicate? like being attached to a repped actor or something?
trying to track down an actor appearing on client that shouldnt
How is it being spawned?
nothing fancy MySquad = GetWorld()->SpawnActor<ASquad>(UGLGameInstance::GetGLGI(this)->SquadClass);
behind a check
if (GetLocalRole() == ENetRole::ROLE_Authority)
{ ```
@lyric skiffYou should be able to do the Server -> client stuff just by replication
Repnotify is your friend
are you saying something specific in the example should be set to repnotify?
Casting a spell should look like replicating some data and spawning some replicated actors
health on all pawns is replicated and the projectile actor is replicated\
i'll just be more specific here
the issue right now is that clients cannot use that spellcast event when its run on server
and i'm not sure why
or rather not sure how to fix it
Unless your abilities get too fancy, you can probably just have a multicast PlayAnimation node and do the rest with regular replication
but I like just haveing a replicated variable AnimationToPlay and using RepNotify on it to drive it
i need further info on how exactly repnotify would drive it
So for example, casting a fireball would look like
AnimationToPlay = SingleCastRighthand
Spawn Actor Fireball
You'd probably want to roll all this up into a PerformAction struct tho I'd guess
Depends on how you define your abilities
i have an ability struct
but lets forget animations and stuff for right now
i just want the logic to work correctly
I don't understand why a "run on server" event on a pawn, called from the owning player controller would not work
it spawns a replicated actor so all seems to me like it should be fine, and it does actually work when used on the listen server
however the clients are unable to run this event
Is the pawn actually replicated?
yes
i think i already did lol with those screenshots
inputaction --> spellcast (player controller run on server) --> spellcast (pawn run on server)
First of all you don't need all that get controlled pawn stuff
you're in the controlled pawn
but anyway, you don't need to do it like this
do all run on server events in playercontroller or some floaty vision pawn
ok i'll try moving the actual spellcast logic to the controller
replying to myself for future searchers. APawn has a some methods that override replication (Search SetReplication in APawn to see what needs overriding)
in a generic way. That's how you're passing orders from your computer to the server
Input/UMG -> Run On Server Event -> Pass order to character
okay i'll give it a try
i mean is what you're defining not exactly what i have here?
input action -> spellcast (run on server) -> pawn
Is that in playercontroller?
yes
That's close, just include more info in the RPC and change it to PerformAction or whatever and instead of calling it on controlled pawn, pass over the pawn you wish to command or a reference to CurrentPawnWhosTurnItIs or whatever
I would pass over in the RPC
- Who you want to do the thing
- What thing you want them to do
- Other info (Target location, options, etc)
@kindred widget I am lost. I have created a dynamic multicast delegate and broadcast it on AddPlayerState this adds lots of more questions. The code for the PlayerInfoWidget creation is inside my player character. I wanted to call it inside the AHUD (BP_InGameHUD) but via the log I can see that the delegation registration is too slow. BeginPlay on AHUD is to slow. In the LOG.png the Begin Play on AHUD misses the first added player state. This was not the hint you gave me right?
And I also can not get the pawn from the player state. So I can not call the function for creating the PlayerInfoWidget there. The OnPlayerNameChanged delegate how I implemented it is also not working. I don't know what I am doing wrong.
Maybe you or somebody else can see where the problem is :S
Otherwise I will use the bind function method for now.
BigDude, HulkSmash, Over Here
MasterBlaster, Fireball, Over There
WimpyMan, Move, Way Over There
I'm so confused what the difference between "calling it on the controlled pawn" and "passing it to the pawn you wish to command" is
both of those seem like the same thing to me pretty much
what does "passing" mean in terms of the unreal editor?
I don't think it really affects the issue at hand but I also do have logic set up in the pawn for showing the projectiles path and picking the spell to be cast so all that is already chosen within the pawn
A controlled pawn would be one that is possessed, so a pawn that you would end up directly controlling so any inputs that you define within the pawn can be used to control it. However, you can still get reference to another pawn that isn't possessed and send commands to it - like if you had a "Selected Pawn" variable in your controller that gets set when you click on one of your pieces, and then you can call functions on the "Selected Pawn" by using the "Selected Pawn" variable as the target to receive the commands.
Can RPC's be called in PostLogin()? Seems like I can't?
GameMode isn't replicated.
I guess I can't call RPC's on the PlayerController as well then?
You can.
I'm calling my RPC from the game mode, but on the PC
But it can't communicate back to the Game Mode.
void AShooterGameMode::PostLogin(APlayerController* NewPlayer)
{
Super::PostLogin(NewPlayer);
// Do Steam Auth
AShooterPlayerController* PC = Cast<AShooterPlayerController>(NewPlayer);
PC->ClientRequestSteamAuth();
}
this client rpc isnt being called
I checked all of the log files
I've been able to call RPCs on the controller as soon as HandleStartingNewPlayer, in blueprint at least. Mebbe there's something up with how you defined the RPC on ClientRequestSteamAuth()?
Having the order depend on state is just more fragile
What if you had a bug where ControlledPawn was lagging or whatever. It's better to be more specific.
Shouldn't be. At the very least, I should be seeing this log:
if (SteamUser())
{
// HIDDEN
}
else
{
UE_LOG(LogOnline, Warning, TEXT("SteamUser() is not initialized!"));
}```
But the UE_LOG is not in the log file
I have a few other logs as well which are just scattered around that aren't in any if/else blocks
Did you ever figure out the cause of this issue?
so i've narrowed it down to this branch that doesn't return true even though i've checked in the editor and that value is set to true for that pawn during gameplay. More issues though because even after that it doesn't actually spawn the projectile actor anyway when I bypass the branch completely
Hi!
The question is about replicating classes.
I have my UTeam class
class UTeam : public UObject```
which contains
```UPROPERTY(Replicated)
int players_count;```
In my GameState I have
```UPROPERTY(Replicated)
UTeam* blue_team;```
GameState and UTeam have `GetLifetimeReplicatedProps()` overridden
Then I have a widget, that tries to access `GameState->blue_team->players_count`
```MyGameState* GameState = GetWorld()->GetGameState<MyGameState>();
int count = GameState->blue_team->players_count;```
It works perfectly fine for server, but when the client is using the widget, a crash occurs with this message:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000038
What am I doing wrong?
your UObject is not replicated
you are just replicating a reference to it, which client can't resolve
takes extra bit of work to replicate a UObject that is not an ActorComponent
also, you're not nullchecking your pointers
makes sense, what should I do to replicate a UObject?
override ReplicateSubobjects() in the Actor that owns it, and IsSupportedForNetworking on the UObject itself
or just use an actor component where that's mostly handled
better learning experience if he doesn't 😄
thank you a lot!
If you set a replicated variable in a "run on owning client" event does it still update the server?
No
i see
It'll update the value locally on the client and then it'll be set back to the replicated value next time the value is replicated out.
Why would you do that anyway?
For your design you shouldn't need much for replicated events. I'd start by just haveing your Client -> Server RPCs and that's it. Rely on replicated state for the rest
i have a custom struct variable in my gamestate class. Inside this struct are 3 map variables. I'm trying to get it so on a widget it gets the struct variable that's replicated from the game state class, and then do something with the variables, the problem is whenever I change the struct on the game state, it doesn't seem to replicate the map variables. It just has the default map values. Any clues on how to get the maps replicated?
so try to use gamestate for everything?
controller just for inputs
No. Replicated actors and variables.
Spell out a situation and I'll suggest how to implement it
currently I have a "ghost" projectile that does a linetrace and shows where the projectile will hit
Local only, nothing to do with the network.
i had it running on client only casue no need for the other person to be able to see that
yeah i just happened to be setting a variable "is aiming" in that though
so i'll just have to change where that variable is set
is aiming a state? Like does aiming happen during a turn or is it like a stance?
"aiming" happens when you press an ability button while possessing a pawn
I thought you were doing turn based
its during your turn
ah ok so it's aim -> fire
yeah
they don't
yeah possessing seems annoying but making the whole movement scheme without it seems really complicated
replicated movement without possessing
No different from AI
you have a good resource for this?
You'll have AI controllers running on all these dudes anyway probably
i'm unfamiliar with ai controllers
I'd do this with the players pawn being an invisible floating camera
Do you intend for movement to be manually driven or click and pathfind?
manual
If it's manual then possessing might be fine, that's a weird hybrid but could work.
yeah its a pretty unique idea and i'm not sure it will even pay off
like be fun
but its my first project so just trying to have fun myself
I have all the possession stuff working already anyway
at least the basics
if you'd like to see it i'd like to show you to see if you have tips haha
but no pressure
does anyone know about having maps inside of structs being replicated? it seems like in a custom struct I made that's replicated on the gamestate class isn't replicating map variables, it's just returning the default map values
Yeah Maps aren't set up to replicate.
Best you can do is make a struct that has the key and value types as variables and make an array of this new structure and replicate that array instead.
ok thanks for this. I think I can make that work
@lyric skiffSo how do turns work, just time?
action points for movement, spells, etc
each turn get a set amount plus whatever you had left over last time up to a max
like divinity
So if it's my turn and i strafe left and right real fast I'll just drain it all and stand there?
yep
i've got that worked out too already although it needs work
like action point movement is working
You could add in a little bit of slop, like the character is dragging a thing 50cm behind them and that's the thing who's movement burns AP
Yeah if you need to manually drive the dudes around then possession makes sense. I thought you were talking about something like Divinity or XCOM
We're making something like a live-action XCOM roguelike
when you say "we" you mean me here? or you're also doing something similar?
nah me and my buddy
oh dank
Sorta like a coop XCOM roguelike with the combat and pacing of the old school Rainbow Six games
slow and methodical
nah twin stick / top down wasd
nice nice
i'm trying to do super methodical too. projectiles in my game will be turn based in movement as well
its actually already implemented as well
So when do they move? Or is it like a SuperHot type thing
move a certain amount on player who fired its turn
I'd consider maybe making it a time system
based on real time?
Sorta like how Pillars of Eternity does things
or you mean super hot
like if the enemy is moving my projectile will slowly move
i haven't played pillars
Yeah basically a real time game but any time nobody is doing an input the time stops
doing input or doing a thing that takes time.
Would make for some cool interactions too like trying to intercept a projectile about to kill your homie etc
yeah there are definitely lots of things that would be cool to try
i'll consider that for sure
so it seems like another issue is that the client pawn "spawn actor" for firing the projectile doesn't work
even though its being run on server
When using SessionInterface->FindSessions( with the Steam subsystem and the test SteamApp ID of 480 - why doesn't it return the sessions of ever other Dev using the same app ID? What/how is it filtering sessions so it only returns my own?
nvm it was because it was using more variables that were set on owning client only
@dark edge so you were right
deleting that fixed my non existing meshes
but the movement isnt replicated however
on the second screen
is set movement mode replicated by default ?
and do saved moves essentially take client data and use that to update the cmc on the server ?
no
Alright, how can I delete asset in PIE?
FAssetRegistryModule::AssetDeleted( AssetData.GetAsset() ) ; This doesn't seems to work.
Or
ObjectTools::DeleteAssets(AssetsToDelete); This compile error
Not sure but you probably don't.
adriel i'm already having problems with some sort of lag maybe you could help sort it out
in order to rectify the last issue (variables were not being set replicated because they were in an event that only had to run on client) at the end of it I made a new event to set all those variables which are used when actually casting the spell (selected spell, isAiming). Now I have significant lag from when I press the select spell button (ie Q or E) and when I can click to cast that spell
I think it's lag only cause the client has the issue and not the server
but i'm kinda unsure what to do about it lol
possibly will have to somehow pass that info into the "cast" event as input instead of just retrieving the replicated variables
but the chain of events that leads to the "cast" event starts at player controller so its kinda sketchy
// Network Prediction Plugin
// --------------------------------------------------------------------------------------------------------------------
After a long road and many attempts, we are dropping support for the async version of Network Prediction. We felt the
complications it introduced into the physics system were too much to maintain and performance was still too poor in
the worst/degenerate cases that it wasn't going to be a viable system for enough games to warrant the complexities.
The original single threaded version of Network Prediction is preserved and unchanged. We still hope to use it to
build a new character moverment system with it. Physics support could come back into this version but it would be
strictly opt in and only applicable to games with small number of objects and players.```
rip
If you mean for the game to control like a 3rd person action game just with your turn ending when you run out of SP/Stamina/whatever, just make it work well without the SP restriction then add the restriction in
You gotta choose whether the players interface with the game is by issuing commands or driving the characters around. If it's driving the characters around then just do it the way all the other 3rd person action games do it
That's a much harder approach though as you'll probably want some sort of prediction, but maybe you can just do clientside stuff with no worries as only one player is moving at a time.
so just have the pawn take input?
If that's the way you wanna do it. Whether the pawn or the playercontroller handles the input doesn't matter really. Depends on what works best for your design
yeah i'll have to play with it
thanks
would checking replicated variables cause it to slow down though? basically what i'm looking at is pressing Q sets these variables (spell to cast) and click to cast it but they're replicated so idk
Going fully turn based Divinity style will be 10x easier tho. Lag doesn't matter in a design like that where it definitly does for live action
Wow, what a disappointment,
yeah i'm just gonna keep going this way cause i might wanna adapt it to a less turn based style game mode at some point
What does that imply, physics support is dead or just some async stuff is dead?
I'd start with not worrying about the turn based bit for now and make a super simple setup work smoothly
Then later you just stop them when they run out of SP
the turn based stuff is already implemented
i'm just talking about lag while using the interface is happening right now
from my understanding mostly
but they may add it back later
uh which one?
@eternal canyonWhere'd you see that?
Actually might only be async stuff
I wonder if that means ur gonna have to have the frame cap now for physics stuff like usual
But the last part made me think it’s physics stuff
Where did you see that? Can't find it anywhere
If u go on the ue5 main GitHub
Go to the network prediction plugin
Should be there
that comment has been there for a month or two now. And yeah, it's specifically talking about async mode.
Unfortunately NPP is still up in the air since the primary author left Epic and we don't know if anyone/who is taking it over.
I still can't find that comment but anyway
Prediction has always been a rat's nest, too many linked systems. You'd think it'd be ripe for some sort of generalized Value / Boundary Condition / Dependency type treatment, maybe that's what NPP is trying to be.
Is Dave Ratie the author?
I honestly don't remember
Multiplayer Movement Jitter
Hey all. I am having an issue with client movement jitter when using P2P. Using a standard set of movement inputs and the character, and components, are replicating; Replicate Movement, Replicates, Component Replicates. and Net Load on Client is ticked.
Is there something I am possibly missing with what I have mentioned? Or could the issue be else where?
Yeah Dave Ratti i think
ah yeah, his name is on the commits
Do you mean listen server?
Yeah. Pardon me. 🤣
Oh shit, my bad, spelled his name wrong lol,
Wow, he left, that sucks.
@round kernelDoes it happen everywhere or just on the host?
The host doesn't see or feel any jitter.
sorry I shouldn't say that. Most times it doesnt see it. But any "client" that joins will feel jitter on input movement. Something like gravity doesn't look like it's jittering from the servers perspective.
@round kernelThat setup looks fine, compare your CharacterMovementComponent settings with a default character's and see what differs
That is indeed a great starting point. -- I have added a few extra components to my current character setup. I'm not sure if that's going to effect much outside of replicating all of them or not.
well, at least we might see a new cmc
bummer though...
Pretty sure he was
yeah, it was Dave Ratti
Quick video demonstrating the recent work to support physics in Network Prediction.
he made some videos about it over the last 2 years
Yea
Well where is Dave Ratti working now?
Are the default projects setup for multiplayer? All the components are not set to replication which makes me think it isn't. Other than that everything is similar on my project settings.
If i do this is the set bool at the end going to run on server?
No
thanks
When testing PIE as clients, is there a way to leave/rejoin or add a new client?
Yes
There's a setting for that in the editor preferences
I guess it's called AddClient
Oh yeah I was right: https://twitter.com/ozmant/status/1400055536784220170
A handy feature in #UE4 that I keep forgetting about: You can add PIE clients at any time to test what happens with late-joiners in a multiplayer game. Super useful. #gamedev https://t.co/6zdM9G3S1b
141
Thanks!
The default third person template movement component should work perfectly
Anyone have any ideas why an input action wouldn't work on the pawn when it works on my controller?
Is the pawn possessed?
Yes
only thing is that it is left click so maybe its overridden somewhere
Your input is being uhhh
Forgot the word
There is a bool you need to turn off on your player controller
hmm a bool?
like a default bool?
is this for all input or just specific ones cause other input actions are working
but i'll check
Your input is being consumed
Not here
For example here, press on the node that has input F
F is working properly
So the input you're talking about
my input action "cast" which is above that
is a custom input action bound to left mouse click
i put F there to test
my bad that was a terrible screenshot lol
Yeah it's an input action
Press on that action event node
And you'll see what I mean in details panel
Cool
Read this so you know the science behind this
Yep
still not working but i'll look at that article
That's how you learn
lol after unchecking in controller it still doesn't work
Make sure it's checked in Pawn
In PC
Not pawn
PC consumes input and it doesn't get to pawn
So you have to make sure all the action events that sit in both have ConsumeInput off in PC
Also if you're not into C++ yet then you can ignore that parts and focus on the other stuff
lmk if you want another spaghetti code challenge i'm facing right now
Well I hate spaghetti, but yeah send away
this is for when I level up a unit, the end part highlights a box on a widget
like so
for some reason the client skips highlighting lvl 2 when it should
server works fine
and heres the spaghetti
so on lvl 2 for any client unit, it doesn't highlight 2, but then on lvl 3 it highlights lvl 2 and so on
on the server it works perfectly
Hell no
lol
On level 3 it highlights level 2 and 3? Or only 2?
Yeah seems like an increment issue
everything else works like the skills you can pick are correct
and the number of skills you can pick are correct
but just the highlighting is off by one ONLY on the client though
idk where it could be going wrong since the level that I am passing is correct on their overhead status bar
and correct when i click on them in the editor
i guess i'll see what number its passing
Yeah debugging can help you a lot in these cases
so it actually is a multiplayer issue though but Idk where it is incrementing differently on the server vs client
Anyone able to shed some light on this, been debugging this for a comically long time and I just can't figure out what's wrong. Super simple, I have a box with a static mesh set to replicate here, and this code here
But for some reason... only the server ever succeeds in replicating changes
I'm super stumped.
you want multicast, not client
client RPCs only execute on the owning client. I'm guessing you don't have an owning client for that box.
You talkin on the Client change Material call?
yes
ah I missed the executes on all
generally you name those multicast, not client. Because client has a specific meaning.
yeah lol, that does make sense
the issue is still similar though
server RPCs can only be executed from the owning client
Now you have trust issues with namings
Oh I already had those
I'm just tired and forgot to distrust things 😦
Anyway, in this case you'd generally want your interact interface to execute on the server.
I'm assuming this is triggered via some sort of input on your player, so you'd have the input call a server rpc on the player pawn or player controller and the server would decide what to interact with
Nvm I got it Wizard, just passed the level into that event
I guess it hadn't updated on the client yet when the client drew that widget
I always pass the object that I'm trying to interact with to the server rpc personally. Then call the interact stuff from there.
Certainly an option, but I'd do extra validation on the server in that case.
You don't want a client cheating and passing an object 10 miles away from them.
Yeah, you do, but I omitted that part for brevity
Replicating takes time, so yeah that's pretty much it
Trying to get this straight mentally, so you're saying a network agent can only fire a server RPC if it has authority over the given object
Because server is the one true version of the game.
Generally, you'll find that you'll be doing all kinds of server RPCs through your PC or Character.
The general pattern for something like this is you RPC what you want to do via the player pawn or controller (or whatever other client-owned object makes sense) and let the server do the same thing you were going to do with the client.
Gotcha, I think this straightened everything out. I'll have to rethink how I'm doing interaction then, glad I prototyped it early 🤣. Cheers ❤️
This is fine. You just need to also call those functions at binding time. You can't assume that your initialization function will run before or after the onreps. For UI, you'll be doing a lot of bind and calling update functions to keep things correct.
Hello, I am calling a function on my pawn that calls a function on server, however when I try calling the function from an actor component attached to the pawn the replicated function does not reach the server, however when the function call originates from the pawn itself (on remote client) it reaches the server, but not when it originates from the actor component attached to the pawn.
Is there something I am missing here ? (component replicates is set to true)
Nevermind, figured it out. Network replication priority was too low
alright, ok thanks again^^
Hey! Quick question, do blueprint replicated variables use the push model?
Would kinda make sense since the engine would be able to know when you call Set on them, but we wanna make sure before we think about porting them to C++
Pretty sure they do not
Porting time it is then, wew
I remember there was a console command to enable them though
what am I doing wrong? why is current weapon stay empty on the client?
Client:
Server: Weapon
I guess that works for props defined in C++
Should not matter since all UPROPERTY but I never used yet
So if its not working its because of something else
Also, the weapon itself spawns on the client
but the variable still stays empty on the client
I am having some problems with replicating sound effects for every client. Does some1 know how that works and might give me a solution for it?
This sfx works fine for every client. Its called in Character BP
Every sound that comes from this bp can only be heard by server
This events are in the gamemode bp
Gamemode only exists on the server.
So how does the multicast events work in gamemode then?
It doesnt calls on every client in gamemode?
They don't. Because the object literally doesn't exist on clients.
No. I'd recommend reading the Networking Bible that is pinned in the channel.
Reading through it a couple times even.
It's the 3rd one from the top...
compendium?
yeah
Ok! Ty
I'm just starting out using Bitwise operations to help reduce network traffic size but I'm not 100% sure on how to refactor existing code. For example I have a bunch of replicated booleans, floats, and ints that should be optimized into a better structure.
Is it just a matter of creating various ENUM structs with strings in CPP and then set their values using a bitwise operator during a multicast? Then on the client side I can just use something like tick to constantly listen for a change in the ENUM to then trigger my bools, floats, and ints to change as normal? Is that correct?
This second screenshot is at the end of the multicast and the first screenshot is an event that fires during tick. Is that right?
generally
you'd have a replication callback when your bitpacked integer changes
then you can compare the per/post replication bits and trigger per state callbacks from there
there is no point in plugging it on Tick, and some of those callbacks can grow not to be cheap
void ADoorBase::OnRep_DoorState(uint8 OldState)
{
const uint8 ChangedStates = DoorState ^ OldState;
for (uint8 i = 0; i <= 5; i++)
{
const uint8 TestedBit = 1 << i;
if ((TestedBit & ChangedStates) != 0)
{
if ((TestedBit & DoorState) != 0)
{
AddDoorFlag(TestedBit);
}
else
{
RemoveDoorFlag(TestedBit);
}
}
}
}``` example of testing difference for 6 different states packed into one byte
Ahh so I should be using repnotify on the "test network enum" to compare before and after bits (using bitwise operations) then trigger the stuff I've already setup from there. @winged badger Is that correct?
pretty much, and also do your networking in c++
BP is pretty horrid
it has 10% of the tools, and half of those are hacks
I've setup the enum in c++ by following a guide, so its already using power of 2. Just the testing and setting in BP. Is that still not recommended?
i generally find it awkward, if you have a mind to use c++
you should do your networking there
I'm a total c++ newbie... LOL
so was every one here at one time
I'm using the network profiler a lot and I'm trying my best to reduce waste.
bandwidth is generally not a problem
unreal is designed to work with ADSL connection, or worse
the chokepoint is usually the time it takes the CPU on server to evaluate actors for replication
I'm more concerned about the AWS outbound traffic bill
ahhh okay that makes sense
And for measuring that I should be using the Unreal Insights tool, correct?
that is pretty decent, yes
but also, and i can't stress that enough
optimizing before you have a game that is somewhat working is usually a suicidal move
I'm at a point where my game is working and I'm teaching myself about optimization techniques and taking lots of notes along the way.
nods