#multiplayer

1 messages · Page 40 of 1

real ridge
#

i tried turn of firewall didn't help

jaunty summit
#

Check the log of your dedicated server for this line to find the port it is listening on:

[2022.12.06-16.07.03:371][ 0]LogNet: GameNetDriver IpNetDriver_2147482494 IpNetDriver listening on port 7790

severe monolith
#

@versed thorn I just ended up thinking about your problem. Couldn't you be able to possess the pawn with an AI controller, and using the GAS through that? that way the pawn isn't possessed by the player controller, but is still possessed. I would imagine that GAS is still replicated from AI possessed pawns.

versed thorn
severe monolith
#

So the GAS is useless for AI controlled pawns?

versed thorn
#

targeting part

severe monolith
#

Maybe just use a seperate targeting system. Or is it too integrated into the whole system?

versed thorn
#

as I mentioned, I'm learning GAS, this is the whole point

severe monolith
#

Yeah, i'm also not familiar with it. Bummer though, i think i will end up hitting same wall as you

#

if this is truly a problem

versed thorn
#

don't panic before time, just wait and see if it would be good fit to use custom target logic for you

round star
#

Lets say a game used dedicated servers for a round based game. It needed dedicated servers because of the size of the world and all the data it has to crunch...but it never relied on anything like 'skilled based matchmaking'. It could pair you with anyone so none of that mattered.. ....Would it make sense for someone to start a game as IF it were a listen server and control parameters in that dedicated server. So "start game" creates an "instance" that people can join. ..but then how does the client who started that server instance changes parameters when they are just a client. Would it be as simple as doing other checks like only the player ID who started the instance can change game related stuff

ornate briar
#

If I want to do loging so I can tell if the server or client is running the code logic in C++. Anyone know the best way to do this?

round star
#

getworld()->IsServer() ...i think? Im prolly wrong

#

lol

#

yea but authority is just who owns it though isnt it

#

I always just use a straight up is the server check

prisma snow
#

I usually use NetMode

#

since HasAuthority() can return true on clients if the client owns the actor iirc

bitter oriole
#

Which is the point, yes

#

If only the client owns the actor it doesn't exist on the server

#

If it just owns it but the actor is replicated, then no, HasAuthority will not return true

#

In other words HasAuthority is always the correct choice for "can alter state for everyone involved"

ornate briar
#

Okay I'll use HasAuthority() and then put debug statements inside that check?

bitter oriole
#

Sure

rose egret
#

how to detect initial replication in OnRep_ because of actor becoming relevant ?

#

im using GetGameTimeSinceCreation() but it doesnt work

ornate briar
#

Thank you my logging works on server only

severe monolith
#

I'm a bit new to replication, and maybe someone can help me here. I have a player controller, which can select a number of units. It works by sending a handle input event to each selected units when selecting a location or actor. The processing of the input will happen on server side, in the object itself (Like checking if the player who sent is the owner of the unit, however i don't use the owner system here as it is possessed by an AI controller, which claims ownership. RTS style system.)
However, only the listen server is able to send input. The client gets nothing executed in the object. (Only if i run it client side, but then it just fails to get compare the owning players, and i don't want this happening for obvious cheating reasons.) Anyone can help me with what i did wrong? Attached picture is from player controller

#

And this is in the object

#

The Process on Server string never gets run when the client attempts to do anything

#

but the other two strings do

real ridge
#

guys I have this problem when I connect to session sudennly I have problem with loading map it never happened to me before

torpid girder
#

hello, i am back to trying to figure out why remote characters fall through the floor, my server has the characters in the correct location but the local client seems to have something set that isn't generating a collision

severe monolith
torpid girder
#

could be, what setting is it to replicate collision ?

sinful tree
torpid girder
#

more than simply bReplicates = true; ?

young spoke
#

out of curiosity, why is MovementMode enum replicated through RPCs instead of DOREPs in CharacterMovementComponent
did devs find it more performant to replicate MovementMode "sparse-ly" rather than through property replication?

young spoke
real ridge
#

pretty clean I hoped for rare but unlucky

torpid girder
#

so it seems the local client doesn't collide the remote character with the floor

#

so the floating character disappears through the floor should there be no movement input

#

if i move forward i will collide with where the character should be

#

so it must be on the server

severe monolith
young spoke
torpid girder
#

i can't see why it isn't but let me check

young spoke
#

also check the collision channels to make sure it agrees with your floor

torpid girder
#

if that was the case, shouldn't the local player fall through? and i shouldn't get blocked on the server

#

landscape is set to block all, the capsule is set to block all, other than my poor retargetting effort, the sub skeletal mesh is block all

#

the blue skel isn't else i have issues

young spoke
torpid girder
#

that is right

#

so the remote character is falling through the floor

young spoke
#

and since replication is turned on, the server will adjust the actor back to floor

#

and the client will send it falling agian

torpid girder
#

so both local characters are correct

young spoke
#

so your issue is with a simulated proxy

torpid girder
#

ah is that what you call the remote client

#

locally both are fine, the proxy is falling through the floor, once movement has stopped

#

however i can run into the other proxy

#

and collision events trigger

young spoke
#

if you check the details of the simulated proxy character, does the collision stuff look correct

#

while game is running

#

sorry i'm still learning myself so just spitballing

torpid girder
#

now you might need to teach me how i check, is that ejecting and something?

#

the collision is working as expected

#

the larger character can't walk through

young spoke
torpid girder
#

looks to be falling

jaunty summit
#

I found this works for me when testing on a LAN (not across the Internet)

#

Without the -local it doesn't work

#

But on my Linux server on a remote server in some other data centre I don't need the -local

indigo brook
#

I'm going to be jumping head first into multiplayer game making via blueprints. Any tutorials that you guys suggest? I have been using UE for years now but never played with multiplayer much

young spoke
#

i am here once again asking...
in rts multiplayer, are physical attacks (or any action/ability) multicasted separately on all units? are they batched into 1 call for a group of units executing an attack on a particular frame? any guidance/docs on this greatly appreciated

real ridge
jaunty summit
#

If run on remote server (I mean a completely different building) then that is over the Internet (a WAN).

jaunty summit
#

Question to all : Say I want to create a multiplayer game where you can cast spells of varying casting times. That is they take a specific number of seconds of arm waving before the spell is activated. Would you use one animation montage containing a looping section for all spells or a different animation montage per spell? Also, would you use RPCs or RepNotifies to react to the Montage Notify that is placed somewhere inside the montage to activate the spell (to spawn a fireball or something)?

thin tulip
#

Does anyone know how UClass net serializes? Having trouble finding the actual function it uses.

#

Want to know if it ends up replicating the path name or something more efficient.

real ridge
round star
#

If a player wants to host a match with a dedicated server...am I able to run some type of command to execute the server instance

rose egret
#

Actor.CreationTime on ded or listen server is always 0

#

why

#

🤔

dark edge
#

Don't fuck up and spin up 10k x as many as you need, heard about someone doing that lol.

#

Unless you're talking about a machine-local dedicated server as a separate process.

woven basin
#

Are you using 5.1? There is a known major bug in 5.1 that Anim notifies are not working in some instances of multiplayer. It’s on the Unreal bug tracker.

#

I would assume it’s going to be did in the next patch , as it’s the highest voted bug at the moment affecting 5.1.0

woven basin
#

Yes

jaunty summit
bleak raft
#

Anyone tried to send FVariant over RPCs ? It's not declared either as a UCLASS or USTRUCT so UFUNCTIONs don't accept it as input

#

I feel like I'm doing something wrong because Epic comments in the FVariant definition mention using FVariants with networking

bleak raft
#

Ah well it seems like FVariants are not union types and are pretty much useless for the purpose of a union

#

This will NOT work

bleak raft
#

Yeah crash was encountered 😅
Does it crashes in cpp ? In C it doesnt, it just returns garbage values

dim trail
#

if I call GetPlayerCameraManager from a pawn not possessed by the local player and ask for index 0 will it not return the local player?

#

assuming there is only 1 client, so index 0 is always the local player

fossil spoke
#

There is only one PlayerCameraManager on each Client. So its always the local PlayerCameraManager.

#

It shares the same lifecycle as the PlayerController.

dim trail
#

thats weird, im getting a read access violation error from calling this from a pawn not possessed by the player

FRotator CameraRotation = UGameplayStatics::GetPlayerCameraManager(GetWorld(), 0)->GetCameraRotation();
#

this pawn doesnt have a camera though

fossil spoke
#

You should always check your pointers.

#

You arent checking the return value of GetPlayerCameraManager isnt pointing to nullptr before using it.

dim trail
#

i dont see how that would ever be the case, it works for the possessed player every time

fossil spoke
#

Where is this code being called?

dim trail
#

on tick for both the pawn and player

fossil spoke
#

The PCM might not have been created before the first tick...

dim trail
#

should i add some sort of delay before calling the function on tick

fossil spoke
#

No, just check it before using it and provide some default value if its not valid.

#

Or output an error of somekind so you have a chance to see if its invalid later as well.

distant vault
dry pebble
#

Has anyone ever had issues where in your custom movement mode you can't jump? I override IsCroucing() and IsMovingOnGround() to include my custom slide, but it fails here in Character.gen.cpp - it returns false meaning CanJump() returns false, but I can't really read what's going on with the ProcessEvents.

    bool ACharacter::CanJumpInternal() const
    {
        Character_eventCanJumpInternal_Parms Parms;
        const_cast<ACharacter*>(this)->ProcessEvent(FindFunctionChecked(NAME_ACharacter_CanJumpInternal),&Parms);
        return !!Parms.ReturnValue;
    }```
#

Says that "Customizable event to check if the character can jump in the current state. Default implementation returns true if the character is on the ground and not crouching" - how would one customize CanJumpInternal()?

thin tulip
#

Has anyone tried messing around with the new SmartObject system in multiplayer? I'm curious if there's something you can do to get the SmartObjectCollection to net load on the client. As far as I can tell, by default it's never present in the clients' world which causes a lot of the features not to work if you're trying to predict things locally.

thin tulip
#

BlueprintNativeEvent create a *_Implementation() version that is the one that will run if a blueprint hasn't implemented the event itself.

#

So either you can override that function in your C++ character subclass like any other virtual function, or you can override the CanJumpInternal function in your character blueprint and do it there.

quasi tide
thin tulip
quasi tide
#

I don't think so. The roadmap stuff is nigh useless at this point anyway. We won't know what's actually coming in 5.2 for awhile.

#

Don't remember where I saw it. But one of those two channels

thin tulip
#

My use case is a little abusive anyway, I was experimenting with using them as the basis for all interactive objects in my game, including human players (which run locally for prediction).

thin tulip
#

We will support client-side smart objects in the future, especially that there is internal work to support player's interaction with smart objects. Clearly I was just ahead of the game. 😉

#

Thanks again!

dry pebble
#
bool AMMOCharacter::CanJumpInternal_Implementation() const
{
    if (MMOCharacterMovementComponent == nullptr) return false;
    return bIsCrouched &&
        MMOCharacterMovementComponent->IsCustomMovementMode(CMOVE_Slide) && JumpIsAllowedInternal() ||
            !bIsCrouched && JumpIsAllowedInternal();
}```
dry pebble
#

So I learned that when you make a custom
FSavedMove_Character for custom states in the CMC, you need to store inputs in there, even if they're not being sent as a flag, so it can be used for replays. E.g A crouch bool for sliding. Is this also true for input that CANCELS your custom movement? E.g pressing Spacebar to Jump to cancel a slide. Should you store that in your
FSavedMove_Character too for replays?

pastel fiber
weak linden
# pastel fiber

Because it being present in the header, as well as the cpp is more consistent

pastel fiber
# weak linden Because it being present in the header, as well as the cpp is more consistent

Another resource I read:

Besides marking the variable as replicated, you’ll also need to implement the GetLifetimeReplicatedProps function in the actor’s cpp file. One thing to take into consideration is that this function is automatically declared internally once you have at least one replicated variable, so you shouldn’t declare it in the actor’s header file. The purpose of this function is for you to tell how each replicated variable should replicate. You can do this by using the DOREPLIFETIME macro and its variants on every variable that you want to replicate.

weak linden
pastel fiber
#
#include <iostream>

class Parent {
public:
    virtual void Job();
};

void Parent::Job()
{
    std::cout << "Parent::Job()" << std::endl;
}

class Child :public Parent
{
public:
    void Job() override; // this declaration cannot be removed!
};

void Child::Job()
{
    Parent::Job();
    std::cout << "Child::Job()" << std::endl;
}

int main()
{
    Child c;
    Parent* p = &c;
    p->Job();
    return 0;
}
muted prairie
#

What’s the best way of getting a reference to the player controller of the actor that hits a collider? i tried getting player controller or the pawn 0 but it wont let me spawn in the right place. ive narrowed it down to something involving the client/server system because i rewrote this level transfer in a fresh project and it works fine, and my current setup spawns a new pawn in the right location but not my character

latent heart
#

That should output the child one, MOP

plucky prawn
muted prairie
#

Ok I’ll give that a shot in the morning. Thank you. This level transition is driving my nuts lol

hallow sand
#

How do you make the player character capsule not a brick wall to other players? IE like in PUBG, getting hit with a car sends you flying.

plucky prawn
hallow sand
#

That would just make it hit or pass through, not react to being hit

plucky prawn
#

That's not what you asked for. Make sure your capsule generates overlap events and override the overlap event for your character

pastel fiber
# latent heart That should output the child one, MOP

Yes. I know this. It was posted to compare declaration void Job() override; which is mandatory with declaration void GetLifetimeReplicatedProps(...) const override; which is optional even though the actor has replicated properties.

hallow sand
hallow sand
#

Like a player being able to push through a crowd of AI capsules, that's all overlap code instead of physic 'strength' so to speak?

plucky prawn
#

Probably. I haven't look into it at all so I can't give you a definitive answer

#

But pushing things around usually requires you to simulate physics on one of the actors involved. Doing this on your player will ragdoll them and doing it on a vehicle would probably stop it from animating and being drivable. That's just a guess though

hallow sand
#

Joyous lol

plucky prawn
plucky prawn
# hallow sand https://tenor.com/view/google-exists-google-search-it-geekboy-geekboy-cz-gif-259...

I googled "ue4 push player out of the way", literally the first result https://forums.unrealengine.com/t/how-to-make-players-push-each-other-out-of-the-way/576476

#

Took me about 10 seconds including the time to load that page

pastel fiber
#

I don't understand why the server RPC is bound to mouse click event directly without checking HasAuthority() as written in https://github.com/pstricks-fans/Elevating-Game-Experiences-with-Unreal-Engine-5-Second-Edition/blob/a361e28a70c07e4605f1cbed8ee26b6bff1bfb6b/Chapter17/Exercise17.01/Project/Source/RPC/RPCCharacter.cpp#L84

Should the server RPC be invoked only in the server?

GitHub

Elevating Game Experiences with Unreal Engine 5 - Second Edition, published by Packt - Elevating-Game-Experiences-with-Unreal-Engine-5-Second-Edition/RPCCharacter.cpp at a361e28a70c07e4605f1cbed8ee...

hallow sand
sinful tree
#

In the case of a mouse click it can only come from one of two places: A client, who would probably want to send the server RPC, or a listen server host, who doesn't need it to execute as an RPC but still needs it to execute the server related code anyway, and it will.

pastel fiber
#

OK. THank you. 🙂

steep panther
#

im using rep graph; after attaching my main player character to a vehicle pawn, then possessing the vehicle pawn and driving away, once I exit the graph range, it hides the player character?

dawn nova
#

Hey guys, I'm having an issue with my dedicated server, when I turn the packaged shipping server on, it gets stuck after LogStats: UGameplayTagsManager::InitializeManager - 0.004 s, it does nothing after that, no error message, nothing. Even if I leave it for a few minutes. I'm not sure how to go about debugging this, could anyone maybe give some tips or help?

#

I'm on UE5.1

rose egret
#

when client receives a replication packet, it changes all the properties then call OnRep_ yes ?

#

because im accessing another replicated property in OnRep_

dawn nova
#

Yes, when the client variable has been updated OnRep is called afterwards

low charm
#

is there a tutorial for VR multiplayer somewhere i just can't get it?

kindred widget
muted prairie
amber saffron
#

can someone explain why this doesnt work for client. in a bp i rep notify the setting of a variable off of "switch has authority". then in the rep notify i just set the skeletal mesh to that variable and then set its animation. this works on listen server, but not client

kindred widget
amber saffron
amber saffron
#

ok now im confused, after telling it to set the cockpit variable, i tell it to assemble, the client attempts to assemble the meshes following its rep notify function but it wont set the skeletal mesh before that

zealous wind
#

I have a really odd Replication issue (Dedicated server), apologies that I can't share screenshots or videos (work project).

Basically, I have two clients connected to a server. One possesses a pawn and flies (helicopter) around for a bit. On the server and the Autonomous proxy, the replication is as expected. However, on the Simulated proxy the helicopter is doing all sorts of crazy shit, primarily rotating endlessly around it's X axis. Are there any reasons that the position, velocity and rotation aren't being replicated properly (it doesn't happen immediately, takes about 20 seconds before it all goes haywire).

#

Does anyone have any idea what the hell might be going on? I thought the Unreal replication system would replicated pawn position/velocity/rotation pretty reliably

tired mason
#

hey, by chance did you ever make headway with this?

sacred coral
#

Unfortunalety not, didnt had time to look into personal stuff

#

afaik its due to mappings/abilities dissappearing from ASC that is on Player Controller

tired mason
# sacred coral Unfortunalety not, didnt had time to look into personal stuff

No worries, thanks for the reply! I'm digging into it a bit, and will share my findings here. So far I've narrowed it down to 2 locations to where I think could be the solution: LyraPawnExtensionComponent & LyraHeroComponent

Both are documented by Epic in Lyra's documentation as being important with possession/unpossession. Likely it seems its the pawn extension, but I need to get some more caffeine in me, and dissect more.

And yeah, it's certainly mapping poofing. It seems its holding other abilities still though, or at least I assume that so far since when I repossess a pawn, the pawn will hold its gun still properly with animations & all the UI shows abilities still, which I assume wouldnt be the case if it really nuked all of the abilities granted period.

#

I did a LOT of digging for any sort of function or loop hole with initializing those components through blueprints last night, but with no progress. Best I got was getting the character to not T pose, and actually animate properly still after repossession, which I guess...is some progress lol

#

I'd like to put a bounty on this information about how to properly handle re-possession of a Lyra character. I got a REALLY good AAA quality 3D modeler with 10+ years of experience thats willing to render his services in a barter (free custom model for the bounty hunter, provided the information pans out) for USEFUL information on how to re-possess a Lyra character. Attaching a screenshot of one of his models, will give his ArtStation if asked. He actively works in the industry & I personally can speak for his AAA practices in workflow.

Regardless, I'm going to keep working on this issue, and go full detective mode. Just putting this out there in case I can't get it figured out in a timely fashion & someone else sees this who could use his services who knows how to make this happen

sacred coral
#

Idk how proficient u are with coding, but i've had a possible solution relayed to me some time ago, and it is to clean the pawn OnUnpossess() and then call ULyraHeroComponent::OnPawnReadyToInitialize() in OnPossess().

Lyra definitely is not set up in any way to allow you to "reuse the pawn" during the session (it just solves a lot of possible multiplayer issues). I assume one of the approaches would be to instead of fighting with that approach - use it to your advantage - and instead of repossessing, simply destroy the old one on leaving the vehicle and respawning the whole player pawn when he leaves the vehicle in the new spot.

If you are set on repossessing due to game design or just you want to do the things "properly" though. There is a lot of stuff to take into consideration (thats why i kinda gave up), basically :

You have to dig trough hero pawn component, the pawn extension component, the ULyraGameplayAbility_Reset, the ALyraGamemode (where player restart can be requested),ULyraHeroComponent, ULyraPawnExtensionComponent(look into handle controller changed)

tired mason
sacred coral
#

Give me a ping if you ever get it to work 😉

tired mason
#

/** Pawn data used to create the pawn. Specified from a spawn function or on a placed instance. */ UPROPERTY(EditInstanceOnly, ReplicatedUsing = OnRep_PawnData, Category = "Lyra|Pawn") TObjectPtr<const ULyraPawnData> PawnData;

wonder if I expose this to blueprints, along with some of the init functions if that would do the trick

jaunty summit
jaunty summit
#

I've heard from someone who stress tested UE5 that it is the cpu-cost of the UCharacter class which is the bottleneck on the client end.

#

Indeed. I can think of situations where there could be 300-500 players in one area though. During sieges and realm-vs-realm battles. I've seen it happen personally. I often ran in a battlegroup of 100 people from the realm of Albion. It often encountered another battlegroup of an opposing realm, of similar quantity, e.g. the Hibernians or the Midgardians. There are 3 realms in this game so its quite common that 300 players meet at some crossroad location and battle it out. Or a bg might hit another bg that is laying siege to a keep, from behind.

#

Its like a big battle D&D game with old style graphics that have no normal or roughness texture maps.

#

The 3 realms have their own areas where the other 2 realms cannot go though. This is their levelling up area.

pine karma
#

Anyone have any articles or advice to start looking into lag compensation? I.e. client vs server when a player casts an ability, what happens for those that lag

Primary looking at MOBA, but imagine shooter is just as relevant

dawn nova
#

Hi guys, when running my dedicated server it gets stuck on LogStreaming: ProcessPendingCDOs: Creating CDO for 'Class /Script/MyGame.NonPlayerCharacter' for request id 35, releasing 1 nodes. 16 CDOs remaining. there's nothing really special in the constructor. Does anyone know where this problem can originate from?

subtle patrol
#

Hey, what’s the best practices to avoid rubber banding

#

Like I see big games like scum which is made with UE4 on a server with 65ms you can actually feel the lag sometimes

#

This is due to packet losses but still I need to understand what need to avoid and what to check

graceful flame
# subtle patrol Hey, what’s the best practices to avoid rubber banding

Depends on your game, the default character movement component does a pretty good job. If you have custom or complex movement modes then you need to duplicate the CMC into your solution so that you can implement custom packed movement data. Also make sure to setup and use your own client prediction whenever you can to help smooth out the experience and minimize the feeling of lag for the players.

orchid flame
#

Hello, Help, i am trying to make a matchmaking system but me and my friend are not in the same matchmaking, what did i do wrong?

lucid pewter
graceful flame
#

Someone has to create the session and it has to finish loading before someone else can join it

#

Looks like you're trying to join a session then create if it fails, but you need to use the top output pin on that Create Session node, the success is just what happens after (i can see why thats confusing)

#

the open level needs to be connected to the pin above

lucid pewter
#

Sorry for my English

lucid pewter
graceful flame
#

I dont know anything about your game so no, but this is a topic that has been well documented already.

#

The difference between listen and dedicated is something you guys need to decide together as a team because your choice dictates how to build and design multiplayer in your game.

weak linden
dry pebble
#

Does anyone know if we have to store input in a custom FSavedMove_Character if we use the state of our acceleration to influence if we can exit the custom state or not? E.g if we are sliding, then press "s" to accelerate backwards which cancels our slide.

pastel fiber
#

The doc seems to be inconsistent. What do you think?

quasi tide
#

No. The prefix is saying that "this will be RPC'd to Server/Client"

pastel fiber
#

The term "called on" and "executed on" are used inconsistently here.

quasi tide
#

They mean the same thing

#

It's like being pedantic about it being a function or method.

sinful tree
#

Just like you could say you're calling a client RPC on the server, and that calls it on the client.

pastel fiber
#

My understanding as non-english native:

  • ClientRPCFunction_Implementation() will be executed only on the CLIENT version of the replicated actor.
  • ClientRPCFunction() is called on the SERVER version of the replicated actor.
signal meteor
#

How often do you guys synch transform and other variables. How many times per second?

quasi tide
#

Whenever it is needed

signal meteor
#

Ok interesting.

#

Beyond 5 it becomes too latent?

#

Lower than 5*

quasi tide
#

No hard number

#

sync it when necessary

#

Too many game-specific scenarios to give a definitive answer

#

You may only need to sync it once. You may need to do it in tick.

#

It just depends.

signal meteor
#

ok

torpid girder
#

morning, i am back to trying to figure out proxy characters are falling through the floor

main vessel
#

Hi guys, I've to make a teleport responsive for multiplayer, with client prediction, someone can help me?

timid moat
#

I'm getting this error: "Assertion failed: PIEInstanceID != INDEX_NONE [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LazyObjectPtr.cpp] [Line: 22]" when the player joins a session and try to open the level map. The listen server player is already one the level, but when the client try to joins I get the error. I have tried the same code but, with an empty basic level, and I don't get any error.

#

Any idea?

#

Thanks!

latent heart
#

Have you disabled "run under one process" in the advanced settings? Might help if it's getting confused.

timid moat
#

Maybe the level is too "heavy" and my computer is too old.

latent heart
#

Run under one process runs all the clients in the single engine instance and it can get messy. The engine can't tell the difference sometimes.

#

That never happens at runtime, so it's probably a bad thing to use it at edit time.

#

Finding what exactly caused your issue is probably a waste of time if it works in different processes. (It's likely an engine edge case issue.)

timid moat
#

I don't remember, but I think I tried this level with two players and it worked without any problem. I don't know why it doesn't work.

#

Thanks. I will continue without "run under one process" enabled.

prisma snow
#

I started doing it recently

latent heart
#

When I was doing mp stuff yeah

#

Even if you don't have any problems, it's not a real test of mp simply because it's all in 1 process.

#

Why would you test in something that isn't the same as the runtime environment?!

#

It makes a considerably difference!

torpid girder
#

hello, i am back trying to figure out why the proxy is floating and then falls through the floor, so i've tried a number of things, i tried a fresh project to test if (see code) would cause a ACharacter to fall through the floor in a player as client, it did not, I was hoping this was the issue

#

i've tried different replication options, replication of different character components, none made any changes in behavior

#

the character seems to be in the correct position still on the server as a local client can't push past the location of where the remote player should be

torpid girder
#

oh i've managed to get different behavior between the big editor game window and the pop up, should there be a difference between the two?

narrow prairie
#

i have a question about multiplayer and widgets. i know widgets only exist on client. thats what my question is about. if i do a debug string on the widget as object and get display name the widget name is the same on server and client. is this correct behavior or am i missing something.

#

whereever i create the widget, pawn/controller/hud the resulted widget name is always the same

#

widgetname_c_0_1

torpid girder
narrow prairie
#

it exist on the local player controller

#

so a server has its own widget

#

and the client has 1

torpid girder
#

i avoid creating widgets on the server, what good can it do?

narrow prairie
#

ur doing good

#

but thats not my question

#

is it the correct behavior the widget has the same name. i suppose it is., since it only exist locally

#

and thus have the same name

#

there is no faulty behavior in my game atm

torpid girder
#

shouldn't even exist on the server

narrow prairie
#

i know bro

#

but a server/client model

#

a server can have a widget locally

torpid girder
#

don't put your domain logic in your forms

narrow prairie
#

but ran on the local controller

#

im not using dedicated server

#

atm i have no faulty behavior im just wondering if the widget name is correct

prisma snow
narrow prairie
#

since the widget is created local, it has the same name?

prisma snow
#

So the order of instancing is the same on client and server

narrow prairie
#

so im mindboggeling for nothing here

#

thx for clarification

prisma snow
#

just make sure you use widgets locally and they are multiplayer unaware

narrow prairie
#

i have no issues atm, i just needed a verify that the widget name is correct/same on client and server

torpid girder
#

forgive me, but that sounds like you are doing something wrong

narrow prairie
#

im not bro, ur misunderstanding

#

im NOT creating a widget on a server

#

im creating the widget locally on a server / client model

#

then a server locally can have a widget just like any other client

prisma snow
torpid girder
#

this has a code smell to me

narrow prairie
#

ill post the widget creating..

prisma snow
torpid girder
#

he is worried about what the server thinks the name of a UI is, i would bet that he needs to keep some domain logic in sync

twilit radish
#

Pretty sure it's correct behaviour though. It doesn't ultimately matter what it's called anyway as its not multiplayer aware. So whether they have the same name on different clients or have different names on different clients really doesn't matter. I believe you can even give it a random name if you want 😄

narrow prairie
#

called from post login

#

game mode

torpid girder
#

that is code in your gamemode?

narrow prairie
#

nope

#

on client

#

pc

#

as i said before, i have no issues atm. im just wondering if the naming is correct on the widget

#

i just wanted some info

twilit radish
#

It is just fine yes.

narrow prairie
#

thx for the clarification, then i can continue

torpid girder
#

back to trying to figure out why proxy character fall through the floor

#

how can i check properties of a character while the game is running in editor?

narrow prairie
#

blueprint debugger

twilit radish
#

Debugger yeah or the famous print messages 😄

narrow prairie
#

make a funcion library for print messages

#

^^

torpid girder
#

i want to examine the collision settings

narrow prairie
#

under viewport

#

u can show collision

#

where it says show

#

u can enable collision checkmark

torpid girder
#

while the game is running, not sure if you can see one character is floating, when it stops moving it drops through the floor

#

i assume its the capsule that stops this from happen

narrow prairie
#

input should be done locally and a call to run on server

#

so both game instances are in sync

torpid girder
#

input and then no input and bye bye

narrow prairie
#

might be fighting server

#

the client that is

torpid girder
#

the server has the right location for the character

narrow prairie
#

server trying to correct u to other position

torpid girder
#

so you can't move through it

narrow prairie
#

maybe...

#

so ur doing the input locally

#

or doing it trough a rpc call to server

torpid girder
#

maybe i need to call AddMovementInput ?

narrow prairie
#

i have 0 knowledge of cpp

#

maybe someone else can help

#

anjd yes

#

u need to call add molvement input locally

#

and a call to server

#

so both instances of the game are in sync

torpid girder
#

they do seem to be in sync, but then when movement stops

#

however it won't take long to add this

narrow prairie
#

gl!

torpid girder
#

that isn't the problem

#

sigh

#

the characters are moving so movement is being replicated

#

also i can see the standard calls being made

#

its like the local client is doing something with the proxy client

#

so if the location only changes on the proxy character, it must be related to a component not being replicated or initalised properly

rose egret
#

is it possible to change the shape of ACharacter capsule to another component?

woven basin
#

I believe the GMC marketplace item does it? I dont think you can do it (easily) otherwise?

tacit bough
#

I'm trying to wrap my head around an issue I'm having with my vending machines.
Everything works fine on server, but things start breaking on clients.

  1. Player (client) goes to vending machine and attempts to buy an item
  2. Vending Machine runs Player::Inventory::AttemptPurchase()

AttemptPurchase() -> updates the player's cash if the purchase was successful.

So in other words what happens is:

VendingMachine->Cast to Player()->GetInventory->AttemptPurchase()

The player's cash just goes out-of-sync although I'm running AttemptPurchase as a multicast.
I'm honestly just pretty lost and have been trying to fix this for the last couple days to no avail.

woven basin
#

There's a guide somewhere - 1 sec

kindred widget
#

Multicast is an RPC. I think you were looking for replication. 😄

woven basin
#

i meant onreps - but yeah - its past my bedtime for me 🙂

kindred widget
tacit bough
#

Thanks @woven basin I'm certainly lacking high-level understanding on this.
What I'm confused about is that we do have the PlayerState class and so in theory I could just have cash be a variable of it and this would solve the problem too right? I'm not sure though.

woven basin
#

yes - PlayerState storing a player's cash count is correct

#

and you update the cash via an OnRep from the server

tacit bough
#

Btw, is OnRep == RepNotify

woven basin
tacit bough
woven basin
tacit bough
rose egret
#

@kindred widget its possible to change but whether the CMC would handle anything fine is a question
this is what I want to move.
actually I realized right shape is capsule but needs rotate

woven basin
#

there are times you might want inventory on the Pawn, like if you can die and leave the items behind etc - but even then it can be managed on PlayerState... that's personally how I do it, but I'm a newb at this stuff too

tacit bough
#

My current scenario is a great example for that:

I've got a vending machine that obviously lives in UWorld, now I don't know for example if:

The Vending Machine actor has to be replicated (whatever that little checkbox does in this context...)

And further the vending machine executes RPCs on the player BP but again there I'm not sure how and if at all stuff like multicast/run on server only/run on client only apply to this as the execution is run by an actor in UWorld, the vending machine blueprint.

I fail to extrapolate answers from the network compendium to this situation hence me being stuck.

kindred widget
#

@tacit bough Client should generally only do the interaction and get the new replicated state returned to it.

(ClientCharacter) Press F > IsInteractable? > IfTrue ServerInteract
(ServerCharacter) InteractWithVendingMachine
(ServerVendingMachine) IsInteractionValid? > DoSpawnStuffOrGrantItem > TakeMoneyFromPlayer

Several Hundred microseconds later client gets the replication from the spawning, granted item or money. The only RPC being involved is the ServerRPC to let client tell server it wanted to do something.

tacit bough
#

So in other words:
*VM: vending machine
client->interact with VM
VM->(run on server) remove cash

(simplified heavily)

kindred widget
latent heart
#

You would need to have a method on your PlayerController called something like "InteractWith" which takes an actor parameter.

#

When you ineteract with the vendinr machine, call that method and pass the vending machine as the parameter. Then deal with it on the server.

tacit bough
#

@latent heart is this not the same setup?

latent heart
#

That's super lower res!

#
  • I don't really deal with blueprints.
tacit bough
#

(When a player gets close to the vending machine, an event dispatcher is bound for whenever the player tries to interact with the machine)

#

So, effectively I'm executing code on my player when I refer to it via the player reference I've got in my vending machine, right? Or is that precisely what @kindred widget you said is not correct.

#

This is run (inside the vending machine) when a player interacts with the machine):

latent heart
#

None of them seems to be RPC related.

#

Where's the Server event?

tacit bough
#

As far as I can tell the Player::Inventory::AttemptPurchase() event is run from the player

latent heart
#

Is the inventory component created client-side? Or the entire character?

tacit bough
#

@latent heart this part:

latent heart
#

Server RPCs will only run on actors replicated from the server.

tacit bough
latent heart
#

That isn't a Server RPC. That's a broadcast RPC.

tacit bough
latent heart
#

It is. You're doing it on your main character class, though? (A component within it)

tacit bough
#

No, I'm doing it from within the InventoryComponent, a comp I attached to my character that I made myself

latent heart
#

Also, your attempt purchase should be done on the server, not the result of attempt purchase being told to the server.

tacit bough
latent heart
#

No.

#

Basically every actor lives on both the server and the client. They are 2 completely separate eco systems - they are linked only very tenuously by RPCs and replication.

#

If you interact with the vending machine on the client, everything you do will be only run on the client until the send a message to the server telling it what you're doing.

#

The execution flow should be (very vaguely):

#
  1. Interact with vending machine
  2. Tell server you're interacting with it (plus any parameters)
  3. The server processes this and either accepts the request or denies it.
  4. If it is accepted, it changes things and updates the clients
tacit bough
#

ohhhh so everything the client sees (also stationary actors) are proxies too.

latent heart
#

Correct.

#

Except stationary actors, they're a bit different.

#

Any actors in the level aren't replicated at all and just exist from the get go.

#

They can be updated by the server, but they aren't created by it.

#

Doesn't really apply to stationary ones, because they can be dynamically created too, just anything that exists in the level itself.

#

But that's what I assume you meant!

tacit bough
latent heart
#

The execution flow never goes to the server at all.

tacit bough
#

If so, would this solve it correctly?

latent heart
#

Unless you specifically tell it to.

#

That seems more correct

#

Though I would pass in the vending machine class, rather than the price, as your parameter.

#

I'm sure the purchase method can work that out.

#

Currently your server event won't know a) what vending machine was used or b) what item it's actaully trying to buy.

#

You may even want to pass the vending machine instance you're interacting with.

#

If that matters.

tacit bough
#

Yeah that's currently split into:

tacit bough
latent heart
#

Just so you know, the flow coming out of that server method isn't run on the server.

#

That's continuing on the client.

#

Only the code in that 1 function is being run on the server.

tacit bough
#

okay I think I'm confused about something rudimentary here.

#

Just to test things out here's the current setup:
VendingMachine::OnInteract->Player(Client)::Inventory::RemoveCash()

#

No server RPC or etc. at all

latent heart
#

That will work locally, for sure.

tacit bough
#

and it works on the server

#

and I don't get why O.O

#

the cash variable isn't replicated either

#

neither does the inventory component replicate

latent heart
#

Replication doesn't work from Client to Server.

#

Only RPCs.

tacit bough
#

Maybe I'm not using the right term. What I'm trying to say is that the server knows the correct cash value of the client.

latent heart
#

Are you playing on a listen server by chance?

tacit bough
#

no, on "client"

latent heart
#

Shrug

#

It shouldn't update the srever if you don't call any rpcs.

tacit bough
#

I've got a debug message showing me the current player's money and it's got a "server:" in front haha

tacit bough
latent heart
#

Are you playing with 'run under one process' on?

#

It's in the advanced settings.

#

Turn it off.

tacit bough
#

advanced settings where? on the player bp?

#

Oh I see it now

latent heart
#

🙂

tacit bough
#

yeah

#

it's active

latent heart
#

Turn it off.

tacit bough
#

still works

latent heart
#

It's magic then!

#

😄

tacit bough
#

Oh!

#

I forgot to mention. I'm on UE5.1 and the Iris plugin is active by default

latent heart
#

I haven't used Iris before. 😦

tacit bough
#

It's a new replication subsystem (used in Fortnite from what I can tell), so perhaps a lot of this magic comes from that lol

latent heart
#

Yeah, I know of it.

tacit bough
#

Yeah, I might want to look into it, might explain the weirdness going on here.

latent heart
#

It still shouldn't break server authoratitiveness.

tacit bough
#

well, to re-iterate here's the complete code flow:
(Vending Machine)

latent heart
#

How is your "server" determined?

tacit bough
#

could you rephrase

latent heart
#

Well, it says "Server: ..." how do you determine if the srever is printing that message? Or is that automatic?

#

It's automatic, right?

tacit bough
#

well usually that's added to print statements whenever something's being printed on the server.
Yeah, automatic

#

I could do a switch authority branch to check if it really comes from the server

latent heart
#

No no. it's cool.

#

Now you've got "run under one process" turned off, it won't print server messages on the client.

#

Therein, you're running on a listen server.

#

Rather than a dedicated one.

tacit bough
#

you think? Although I'm running like so:

latent heart
#

It really shouldn't print server messages on clients 😦

tacit bough
#

yeah, I totally agree with you on that

#

It might really just be an effect of the new Iris plugin tbh

#

That's my only guess

latent heart
#

Add in a print string at the start of the chain, when the overlap starts.

#

(I did not know)

#

How does your Interact event work?

#

I see you binding it, but not calling it.

tacit bough
#

Wait I ran it again now, with separate processes and after adding the auth switch the client doesn't print any messages any more

#

it's called by the player

#

as a server RPC

latent heart
#

That's why it works lol

#

That's a server rpc 😦

tacit bough
#

does this mean everything after it is run on the server as well? or no

latent heart
#

You're binding the event on the server and the client (because the overlap happens on both the server and the client - the client tells the server it's moving)

#

So when your Interact event triggers, everything from that point on is server because you're specifically calling it on the server.

tacit bough
#

ok that's one thing I was always confused about. As in "when I have an event that comes after a server event, is everything run on the server or not?"

latent heart
tacit bough
#

oh so just because it's bound on the server doesn't mean the callback is executed on the server?

latent heart
# tacit bough

If this wasn't a "Replicated to server" node, the lower green box would be red and would run on the clinet.

tacit bough
#

okay

latent heart
#

But the actual interact event is called specifically on the server, so the event (the red/black node) runs on the server.

#

And everything in the execution flow from that point is on the server.

tacit bough
#

So I could keep my AttemptPurchase logic just the way it was with no extra net stuff like (run on server) etc.

#

as everything after the interact callback is run on server

latent heart
#

You have to remember, there are 2 copies of this actor. They're both being bound to their local versions - meaning there are 2 events, but only the server event is ever called.

tacit bough
#

jesus

#

yeah, thanks for pointing that out. Of course since it only ran on the server this whole time nothing ever happened on the client

latent heart
#

Indeed!

tacit bough
#

The reason that didn't seem to be a problem was that up until now I thought that when somthing is run on the server, stuff automatically runs on the client, but that's of course not true.

latent heart
#

Indeed x2!

#

You really have to treat them as 2 completely separate entities.

tacit bough
#

And one of the reasons for that is that everything, every actor exists on both the server and each client. And if I want to change some state I need to be explicit about the netcode aspect.

latent heart
#

Just the server occasionally says "hey, this value has changed" to the client.
(Plus RPC functions)

tacit bough
#

What I did now is have my interact event run as a multicast. Meaning things should work seemlessly for stuff like opening doors in the world and etc.

#

I'm guessing there's a downside to this too though, right? Otherwise everyone would just run everything as a multicast

latent heart
#

I'm not sure that will work as you expect. Depends on the event.

tacit bough
#

(apart from anti-cheat of course)

latent heart
#

Opening a door, for instance, you might interact on the client, tell the server you're interacting and it triggers the door open - but what is that door opening event?

#

Is it an animation you play? Is it the door physically rotating?

tacit bough
latent heart
#

Will the server update the client without needing a multicast because the door's transform replicates?

#

Should the clients also run the opening translation?

tacit bough
#

say it would play an anim. Wouldn't the anim play on all clients and the server in case the door was opened via a multicast?

latent heart
#

For that specific example of a stateful actor, you should trigger events through stateful replication (perhaps with an additional RPC to give it a quick start)

tacit bough
latent heart
#

Replication is specifically the server telling a client about a change in some value.

latent heart
# latent heart For that _specific_ example of a stateful actor, you should trigger events throu...

E.g. A door would have 3 states (potentially) closed, open inward, open outward. You wouldn't replicate animations for this, in fact you might even turn off replication of the door's transform - you would just replicate a state, closed, open inward or outward, and when the door receives the updated state, it animates locally to the correct position. Whether that update is because it was set on the server or replicated from the server to the client.

#

Or you might replicate a "rotation" value of the door and then the server/client interpolates towards that rotation when it receives an update.

#

Of course that won't work with physics, it's just a kind of static animation, but that's one way to deal with it.

#

Doing things statefully like that means that late joiners get the correct state of objects.

tacit bough
#

Yeah, I just read the article you provided. That's something I'll have to think of as I'm working on a game with a persistent world.

latent heart
#

I provided an article? 🙂

severe monolith
tacit bough
#

on you're right haha it was someone else. The article was about OnRep etc.

latent heart
tacit bough
#

I'm confused about one thing.

My Interact runs as a multicast, meaning it should also execute on the server right?
I run DestroyActor() once I pick up an item from the ground. This doesn't work when the interaction happens on the client. How come?

latent heart
#

Multicast, if run from the server, executes on every client and the server.

#

If you run it from a client, it runs just on that client.

#

However

#

You should not multicast destroyactor

#

You should run it once. On the server.

tacit bough
#

say I'm the client, what would the event flow be like?

latent heart
#

Same as it is for your vending machine

#

client wants to destroy thing -> asks server to destroy thing -> server accepts or rejects -> server destroys if accepted

tacit bough
#

well the setup I've got on my vending machine is interactCallback(multicast)-> do all the stuff

#

I've got literally no net-stuff inside my vending machine.

latent heart
#

You don't want to be using multicast for that

tacit bough
#

how come? I mean at least feature-wise it's working as expected.

latent heart
#

Simply updating your component on the server should suffice, if you have replication set up correctly.

#

If you multicast the changes, it's likely you're just doing the work twice.

tacit bough
#

well before all this I had Interact set as running on server. So you're telling me I should have my Interact event run without any netcode specification?

latent heart
#

This should not be multicast

#

It should just run on the server (it currently is)

#

If that doesn't update the clients properly, the error is elsewhere.

tacit bough
#

huh well yeah, if I change that part then the client-side inventory doesn't work anymore.

latent heart
#

Then your inventory system is ill-designed.

tacit bough
#

well there isn't much design to it. It's just an array variable inside a component that I attach to my player character.

latent heart
#

Let me put it another way, how is a client who joins after that multicast meant to know what items are in the inventory?

#

It wasn't there to receive the broadcasts.

tacit bough
#

you mean new players are supposed to be aware of other players' inventory?

latent heart
#

If you're only meant to be aware of your own inventory, why is it a multicast, sent to all players?

#

Multicast RPCs are sent to every client for whom the actor is relevant.

tacit bough
#

you're right on that. I just changed it to "run on client only"

latent heart
#

(or component, I suppose)

tacit bough
latent heart
#

I mean it might be sent to players other than the intended one if it's multicast.

#

Your inventory component will be replicated to all players (unless you've set it to only replicate to the owning player)

tacit bough
#

because gameplay wise I'd think this would mean that when player1 does something and it runs a multicast, then all other players would suffer the same effect. E.g., player1::GiveMoney() --> give money to all players.

latent heart
#

No.

#

It would simply give player1 the money on each client.

#

Which the server would then (hopefully) overwrite when the correct amount is replicated later.

#

RPCs are basically instant. Replication is not.

tacit bough
#

oh... so all the "executes on all" for example would be more precisely "run on current actor, but replicate the changes happening on this actor to all other actors in the world"?

latent heart
#

No

#

Executes on all literally executes that function on each client (and the server)

#

Not the effects of that function, but the function itself.

#

That may be the same, but it may not.

#

Clients may have outdated information, for instance.

tacit bough
#

doesn't any change invoked by a function call invoke that? How can a function run without changing anything? O.O

latent heart
#

Let's say you give player 5 $50 on the server. You wait for replication to update everything. Just after doing that, you run a multicast GiveCashToPlayer5 function. The clients haven't received the $50 update yet because replication can be slow, but they're now giving player 5 some extra cash - so the effect is different.

#

Because player 5, according to the client, has original amount + give cash function amount, not original amount + $50 + give cash function amount

#

And then the server comes along and replicates the correct amount later.

tacit bough
#

meaning the clients and server would be out of sync over player 5's cash status

latent heart
#

Correct.

#

Clients and servers can never be in perfect sync. It just can't happen.

#

Don't rely on it.

#

Again you have to go back to this idea of the server and every client have their own actors, their own copy of every piece of data.

#

And they aren't necessarily the same or updated at the same time.

#

Multiplayer is a dick. 🙂

pseudo merlin
#

hi all, I'm testing listen server multiplayer with PIE. when I press eject in the editor window I view the level from the hosts perspective, and not the client who the editor window is actually running. How can I view clients world with eject? thanks

tacit bough
#

say I've got GiveMeCashMulticast(50) and let it run.
PlayerId: 5

players 1,2,3,4 all run Player5::GiveMeCash(50) + player5 themselves run GiveMeCash()

so

p1: p5 has $50
...
p4: p5 has $50
p5: I have $50
server: p5 has $50


say p5 runs GiveMeMoney(50):

p1 - p4: p5 has $0
p5: I have $50
server: p5 has $0

#

If I don't run any replication on values like this, multicast sounds like it would always be fine as an operation.

#

If I was to tick the "replicates" checkbox on the "cash" variable. If I ran p5::GiveMeCash(50) --> would this replicate to all clients and the server (just with a delay)?

kindred widget
#

Generally speaking. I strongly advise you literally never use a Multicast while learning UE networking. 95% of basic implementations require only a ServerRPC and replication.

latent heart
#

Indeed.

#

To go back to your inventory situation.

#

You've got a persistent world. If you also have persistent characters. What happens if one logs out and then logs back in? How does he know what's in his backpack? His current version of the client wasn't there to receive the broadcasts.

#

Haha.

tacit bough
latent heart
#

Either way, make your inventory system work without rpcs.

#

(client/multicast rpcs)

tacit bough
#

yeah good point

#

by the way... when a player picks up an item on the ground it's supposed to dissapear. however, "Destroy Actor" just by itself doesn't work when run by the client. I've watched a video on YouTube about replicated actor destruction and they've set it up rather weirdly imo. They made two events inside their player character which invoke the DestroyActor method. Isn't there a better to do this?

#

(player character):

#

(Pickubable Item):

latent heart
#

That's kinda stupid

#

I mean, DestroyActor is never invoked on the server...

tacit bough
#

how would you go about it? Say a client picks up an item and you'd like it to dissapear for all clients and the server.

latent heart
#

You do it all on the server.

#

This is the answer to every question. 🙂

tacit bough
#

My instinct would call for a multicast but Authaer mentioned that in a lot of cases it's better to do it differently

charred tundra
#

Hi guys, i'm trying to understand the basics of replication and apply them to a lock on target function i did

latent heart
#

In the majority of cases, if you're modifying a replicated actor/component on the client, you're probably doing it wrong.

#

The exception is things like character movement and look rotation.

charred tundra
#

i just don't really know where to put the nodes for the replication to happen, in what part of the visual script

twilit radish
#

Prediction looks around the corner

latent heart
tacit bough
#

ok, so as a rule of thumb: changes in the world -> change the state on the server. Does UWorld replicate by itself on clients? Or would I have to check "replicated" on actors etc.?

tacit bough
#

I did literally that in one of my projects.

charred tundra
twilit radish
#

Also unironically Minecraft’s item pickup system is pretty clever when it comes to this scenario 😄

charred tundra
tacit bough
#

@charred tundra what exactly isn't working?

tacit bough
charred tundra
tacit bough
#

@latent heart when you say "destroy the actor via the server". Do you mean by that:

call Item::DestroyOnServer()
?

tacit bough
latent heart
#

To touch on the subject Thom raised about prediction, the client might hide the actor instead of destroying it, but unhide it if the server said no.

tacit bough
latent heart
#

Yes.

#

It's the logic that goes around that that determines what "ask" means.

twilit radish
tacit bough
#

if I got that right haha

latent heart
#

That will work if, and only if, "Self" is owned by the player.

#

Because you can't send server rpcs from via actor not owned by the player.

tacit bough
#

whaaah

latent heart
#

So it's basically a suicide function.

tacit bough
#

the concept of ownership is foreign to me. So uh... do I just set the owner and then run this? O.O

latent heart
#

As I was saying before, use the player controller as an intermediary.

#

Player controller, player state and pawn = owned by the player

#

You cannot send an rpc via vending machine, for instance.

tacit bough
#

how is that any different to executing stuff originating from the player character?
The playercharacter executes the OnInteract callback on the item on the ground

#

Isn't that in principle the same thing?

charred tundra
#

@tacit bough

twilit radish
#

The character is owned by the player though.

latent heart
#

character is just a fancy pawn

#

@twilit radish he has his rpcs set up in weird ways

charred tundra
# charred tundra

in this example i removed any replication i tried, so the code is just for single player

#

i don't know where to put the replications

tacit bough
latent heart
charred tundra
#

the code is done so that once you enter the lock on state, animations change

#

with a blendspace

#

how would i replicate that to everyone?

tacit bough
latent heart
#

Replicate the lock on state

#

Then use an onrep to change the animation.

charred tundra
#

btw is that vivi

latent heart
tacit bough
#

oh yah, fair enough haha

charred tundra
latent heart
#

I haven't looked at the code.

charred tundra
latent heart
#

Videos. 😦

charred tundra
#

if you want i can do it

latent heart
#

Works for me.

charred tundra
#

okay okay

#

these are the first two events

native crane
#

lol, might as well post some shady links AtomiKek

charred tundra
#

might there be some hidden

#

i always get intimidated when experienced devs start texting for minutes and minutes

latent heart
# tacit bough is there someplace I can look up the "standard" way to set up interactions and s...

For me, I would have an interface, Interactable. I would apply this to actors which I want to interact with and set them up with an appropriate collision channel just for interacting. I'm sure you've got the collision part done already. The interface would have a single method Interact with takes the Player Controller or Character as a parameter. In the Player Controller, I would have a single Server RPC, Interact, which takes the actor implementing Interactable as a parameter. When you interact with actor, you call this method on your Player Controller. On the server side it would simply do Interactable->Interact(self) and that's it. The object then implements what interact means for it in the Interact event.

native crane
#

You just uploaded extension less files. Just use screenshots or something

charred tundra
#

what

#

what a facepalm

twilit radish
charred tundra
charred tundra
#

i renamed them through discord and forgot to add .png

latent heart
#

Hah

tacit bough
latent heart
#

bLockOnEngage and current target should have an 'on replicated' event.

#

And be replicated, of course.

#

Or whatever other lock on stuff needs replicating.

charred tundra
#

i set all of the variables on "replicate" and i bet that's destructive

tacit bough
#

@charred tundra do you use an animation blueprint?

tacit bough
#

Show us your event graph and your state graph

charred tundra
latent heart
#

So what is this lock on stuff supposed to do? Just make something look at a target?

charred tundra
tacit bough
#

@latent heart yeah, and that part is working for them already. It seems like they want the animation state to replicate.

charred tundra
# charred tundra

then the transition is simply whether or not the user is on lock on engage

tacit bough
#

@charred tundra click on the arrow thingy that goes towards NewBlendSpace and get us a screenshot of that please.

charred tundra
#

the other one is the same but with a NOT node

quasi tide
#

Animation state gets derived from variables on the character.

charred tundra
#

yes

#

i need to replicate those variables but i can't quite do that

quasi tide
#
  1. Replicate bLockedOn
  2. AnimBP looks at that and updates on each client locally
latent heart
#

The thing about replication is, it doesn't work from Client to Server.

#

Are you, at any point, telling the server that you've locked on to anything?

charred tundra
#

no, i don't think so

latent heart
#

Okay, so that's the issue.

quasi tide
#

That's the problem

charred tundra
#

how would i-

quasi tide
#

Use a Server RPC

latent heart
#

For other clients to know about your lock on status, you need to tell the server. The server then replicates it to everyone.

quasi tide
#
  1. Client tells server - "Hey I'm locking on to this thing"
  2. Server goes "okay - let me tell everyone else"
charred tundra
#

mhh yea i understood the basics through some tutorials

#

i just don't know how to do it in practice

latent heart
#

When you change your lock on status, you need to send a server rpc to let the server know.

charred tundra
#

every tutorial i found doesn't explain that in a way that works for me

quasi tide
#

Create a custom event - then on the right, select "Run on Server" under the replication dropdown (or w/e dropdown it is called for events)

latent heart
tacit bough
#

if I understood the others right all you need to do in your character BP is:

kindred widget
#

Wouldn't lock on be client side with setting control rotation though?

#

I mean maybe a ServerRPC if there's a target effect. But for making the character rotate and look there, it's all control rotation.

tacit bough
tacit bough
charred tundra
#

should i check "reliable"?

tacit bough
#

doesn't hurt.

charred tundra
#

okay okay, done that

latent heart
#

Reliable is what you want for this.

#

Unreliable would be, generally, for constant and frequent rpcs.

charred tundra
#

oh, understood

latent heart
#

Like sending your mouse location or osmething.

charred tundra
#

like movement?

latent heart
#

Yeah.

quasi tide
latent heart
#

Unreliable means UE doesn't care if it gets there or not.

tacit bough
#

@charred tundra if you've made all the changes and each time the value changes you also call the ...Server event, try and see if anything changed.

charred tundra
#

so instead of calling the variable directly i should call the event?

#

and swap every reference of the variable?

latent heart
#

No no. If you only need to change the variable, you just need to add a call to that event to your code whenever you cahnge the variable.

#

This is what a setter function would help with, but since you don't have one, just add the calls.

tacit bough
#

if I understand the others (correct me if wrong):

  1. Whenever you lock-on, you update your "isLockingOn" flag inside your character blueprint. And each time you do that you want to call the event that you just made.
latent heart
# tacit bough

This event is missing a bool parameter - the value of lock on...

charred tundra
#

this right?

latent heart
#

If you do that, you need a second event to disable lock on.

#

Call the appropriate one when setting the value of lock in.

charred tundra
#

okay okay

#

and should i call the even before or after setting the variable?

latent heart
#

Doesn't matter.

tacit bough
#

@charred tundra

latent heart
charred tundra
#

ohh i got it

#

so basically we are doing a box for the variable that gets shared to the clients too

#

right?

latent heart
#

Right names aside, pretty much.

charred tundra
#

yea yea that was the practical example xd

#

okay, i tried swapping everything

tacit bough
#

does it work now?

charred tundra
#

the result didn't really change

#

😦

tacit bough
#

not even on the server? (try both ways) server and client.

charred tundra
#

yea, nothing sadly

#

i replaced only the SET LockOnEngage

#

do i need to do it on the getter too? i don't think

tacit bough
#

no.

#

show us your LockOnEngage code.

charred tundra
tacit bough
#

@latent heart btw... I've refactored my Interact flow so that it's just a regular event (not multicast etc.)

I'm having trouble running destroy actor even when I use a server RPC. (tried almost all options possible last 30 min lol)

latent heart
#

Show code.

charred tundra
latent heart
#

Are you sure the bool is set to replicate?

charred tundra
#

do you guys want my project? it's empty other than these few lines

tacit bough
#

@latent heart

latent heart
#

You can't call a Server RPC on that actor.

#

It's not owned by the player.

tacit bough
#

@charred tundra no, but I can hop on a call with you for a couple minutes to debug it. Join the "Feedback & Support" voice chat channel.

tacit bough
#

@latent heart wouldn't this solve that?

charred tundra
#

i don't have the permission to stream tho

latent heart
tacit bough
#

oh lol

latent heart
#

I hate to repeat myself, but add a server rpc to your player controller to delete the actor.

#

Pass the actor as a parameter.

#

Etc.

charred tundra
#

we couldn't make it work

#

@latent heart got any other ideas? i'm lost

latent heart
#

I do not.

charred tundra
#

aaa

tacit bough
#

giova's doesn't replicate correctly for some reason

#

*flag

#

@latent heart I probably misunderstood you earlier than because it sounds like the approach I had going earlier: #multiplayer message

#

in any case thanks for the great help today! I don't intend to steal any more of your time and thanks a lot for everyone invovled.

latent heart
#

Np

spark pine
#

I'm spawning a replicated actor in the Game Mode using the Spawn Actor From Class node. The actor spawns on the server, but is not visible on the clients. Does anyone know what I'm doing wrong? 🤔
(4.27 source, running a dedicated server)
The interesting thing is that it all works fine in 4.27 launcher build without the dedicated server. 🤷‍♂️

sinful tree
pseudo merlin
#

hi all, I've got a mechanic where the player can launch themselves and I draw an arc to predict path based on some basic math. On listen server host this arc is accurate at pretty much any frame rate. for listen server clients they fall off this arc above 30 fps. What kind of stuff might cause this?

low helm
#

It depends on the math

#

But any regressive function can behave differently at different intervals

#

you need to post pics of the math

pseudo merlin
#

sure thanks, here is one snippet that acts differently on server and client

#
FVector ClampedV = FVector(0.f);
GetCharacterMovement()->Velocity = UKismetMathLibrary::VInterpTo(GetCharacterMovement()->Velocity, ClampedV, DeltaTime, GrappleBreakSpeed); ```
#

thats run on tick in both, for server its pretty stable regardless of frames, on client its stable only at 30

sonic python
#

Heyyy

#

I have a problem in my gamee

#

The First One Joining(Creates a session) has the dress selected and the player who joins(joins the session) later , has the default in his own view but when the first one joined sees him , he has the same dress the first one wears…

#

How to fix this??

low helm
#

grappling could be quick

#

Turn these on and see if it still breaks

#

Is there server correction jitter?

orchid flame
#

Hello, we are trying to make the matchmaking system for listen server in Unreal Engine 5.1, Somebody can say why this doesn't work, what did we do wrong?

low helm
#

This question is too vague, you need to post some pics of how this is replicated

#

is it an ONREP variable or an event?

#

etc

lucid pewter
pseudo merlin
#

somewhat related question. If I want to launch a character with the LaunchCharacter function, should that run on all machines, just server, just owning client?

sonic python
#

This is my codes in player controller

#

Sorry for the bad quality

#

This in the set dress rep notify ( in p controller)

#

The Equip dress I'm casting to the player is not running on the server not replicated

amber saffron
#

quick question, is there an order to when repnotifies get called for clients?

fathom aspen
#

Technically it's due to how they are laid out in GetLifetimeReplicatedProps but I wouldn't count on that as it can get pretty messy if we start talking about unmapped properties

amber saffron
#

i just cant seem to understand why this works for both server and client

#

but then this makes it stop working

#

and only works for the server

sinful tree
# sonic python

You do not need to call a multicast to set the "Set Dresses" variable. Instead, just set it when running on the server.

#

The OnPossess event only runs on the server so there's no need to use an RPC. Therefore, you can set the "Set Dresses" variable there without any RPCs.

graceful viper
#

I mean I've read some documents about how multiplayer actually works but not sure where I can go to actually learn how to implement that code correctly

plucky prawn
graceful viper
#

Alright

rose prawn
#

You can think about what you wanna achieve before you start working on your implementation. For example, if your game doesn't really require cheat protection, you can design some of your systems client authoritative etc. It's important to understand how replication works and what do you want

real ridge
#

Need add note that I tried join on server launched at my friend and it was successful, I have same settings on my router and I can't join on session on my router ( from different network)

dry pebble
#

Have an issue where I want to only allow strafing left/right while sliding (custom movement mode in the CMC), But it causes desyncs at 500 ping when I call CalcVelocity for friction. If I call the Acceleration change after CalcVelocity then the strafing changes don't work, but if I call it beforehand, it causes jitter. Any ideas?

Acceleration = Acceleration.ProjectOnTo(UpdatedComponent->GetRightVector().GetSafeNormal2D()) * SlideStrafeMultiplier; 
    
CalcVelocity(timeTick, GroundFriction * SlideFrictionFactor, false, GetMaxBrakingDeceleration());```
pastel fiber
#

Which part in the default character template AMyPlayerCharacter manages player input (left mouse click for example) and propagate it only to the character possessed by the client rather than to ones possessed by other clients?

fossil spoke
pastel fiber
#

What I want to know is the part in which the code delegates the input only to the character the client owns rather than to other clients' characters.

kindred widget
pastel fiber
#

Consider a game instance as a client with two characters.
One character is controlled by the client itself and the other character is controlled by the other client.

As both characters are the instances of ACharacter, they have the same code.

Which part in the code (cpp file name and line number) that determines the player input must be delegated only to the character the client owns?

latent heart
#

The input component on the character probably takes input from the ulocalplayer. I'm sure it'll be funnelled there by the slate application at some point.

kindred widget
#

You're mostly looking for TickPlayerInput on APlayerController. GameViewportClient sends Keys/Axis/Touch to the controller. The local version of the controller runs TickPlayerInput. TickPlayerInput basically builds an input stack and consumes all keys the GameViewportClient has told it were pressed/released

#

Well. Half true. TickPlayerInput does other stuff. ProcessPlayerInput builds the stack and executes it.

pastel fiber
#

Is a character with GetLocalRole() returning ROLE_AutonomousProxy directly controlled by the player on the owning client? For example, the player presses W key to move forward, does this action directly control the character the client owns?

pastel fiber
#

Or...

When a player on the owning client press W, the client does not directly control its owned character but calls a server RPC first.
The server then calls the client RPC to move forward the owned character.

I hope my understanding is correct. 🙂

latent heart
#

Or both.

quasi tide
#

I have an OnRep variable for my current ammo. I do my firing logic client side and then notify the server of a hit (coop game, I don't care about cheating). If they are a client, I go ahead and reduce the current ammo count so the client can see it immediately. The server reduces the count when they get notified.

I have noticed that the OnRep does not fire when I do this. If I comment out the client reducing the ammo count, the OnRep does fire. What am I overlooking? (5.1)

pastel fiber
#

What does Server-Owned Actor mean? Is it an actor that is spawned in if(GetLocalRole()==ROLE_Authority)?

latent heart
#

Not necessarily.

#

A server-owned actor is one that is not associated with a specific player. E.g. Player controller, player state, pawn.

plucky prawn
latent heart
#

Those are the ones that are.

#

I was unclear!

woven basin
sonic python
#

The Second One Who Joins the Game , goes to default and sees others in default

#

While the first one who starts the match , has his dress changed and sees others wearing the same dress he wears..

quasi tide
woven basin
#

"the OnRep behavior will only trigger on the clients when the value of the variable changes"

#

so there is a way in the DO_REPLIFETIME to set it to always. I'm not near my computer at the moment, but its like "_ALWAYS" or something as a flag.

pastel fiber
#
  • RPC with Server specifier will be executed on server when it is called on client. OK

  • RPC with Server specifier will be executed on server when it is called on server. OK

  • RPC with Client specifier will be executed on client when it is called on client. OK

Question:

  • RPC with Client specifier will be executed on server when it is called on server. Why is it executed on server?
quasi tide
thin stratus
#

Client rpcs Run on the owning Client of an Actor. If the actor is owned by the server, then the client rpc is just gonna run on the Server like a normal event.

pastel fiber
thin stratus
#

Both yeah

pastel fiber
#

I watched Tom Looman's course especially the multiplayer part.
He said we need to have 2 PlayerStart actors on the level to make sure there is no collision when they are spawned.

What happens if we have 10 players in a single arena, should I arrange them in advance by dropping 10 PlayerStart actors on the level?

And the default template of third person, there is only one PlayerStart and I cannot detect any collision between players.

silent valley
sonic python
#

Hey my multicast event and owning client event is not working

latent heart
#

Show code etc

real ridge
#

getting this message when I want join session from my pc to laptop both are on different network, ip address is public port 7777 open all settings right

yesterday it was working today not
Need add note that I tried join on server launched at my friend and it was successful, I have same settings on my router and I can't join on session on my router ( from different network)

sonic python
#

i did this in game mode

latent heart
sinful tree
# sonic python Oh but what abt the client ?

Part of your problem is that you are using a replicated variable in the player controller. Player controllers only exist on the owning client, and on the server, so no other players would get the variable being changed.

Your most recent screenshot showing your game mode, is basically pointless to RPC anything in there as game mode only exists on the server. You cannot RPC to clients in the game mode, and clients cannot call RPCs in the game mode.

latent heart
#

Depends on what object he's sending the rpc. WE can't see because it's so low res.

sinful tree
#

Any events in the game mode are strictly going to run in the server, and clients cannot access the game mode.
The game mode can call RPCs in other actors, but nothing but the server can call events in the game mode.

sonic python
#

oh then should i go back to player controller

sinful tree
# sonic python i did this in game mode

If you want your character to change appearances, you want to use OnRep variables to do it since it is something stateful. This means the variable that changes those appearances needs to be on an actor that all clients can receive updates on. As its to do with your character, then you probably want to put the replicated variable on the character itself.

sonic python
#

oh ok

#

wait ill show my codes in character bp

#

This is the function , I use it in other blueprints to call this

sonic python
#

should i do it in a game instance?

sonic python
#

game state

#

it workssssss

#

but the dress client wears is not seen by server and vice versa

real ridge
pastel fiber
#

My settings:

  • Number of Players : 2
  • Net Mode : Play As Client
  • Run Under One Process : Unchecked
  • New Editor Window (PIE) : Checked

When I play, there are two log windows:

  • One independent console window prints server's log.
  • One Output Log window docked in UE editor prints one client's log.

QUESTION:
How to get one more Output Log window for the other client?

rose egret
#

where is the config in CMC for adjusting local client correction ?
my locally controlled char get back to where he was most of the time when he runs fast

woven basin
woven basin
#

Depending on your IDE, once the client starts, your IDE will have an option to attach itself to an existing process.

ember vine
#

If I replicate a struct with a tarray, and implement netserialize, will the array maintain it's order ?

chrome bay
#

yep

weak linden
#

It'll start two copies of the game in "standalone" with logs (and still connect to the server)

#

You can use selected viewport just fine if you don't want 2 separate "standalone" clients to spin up

woven basin
#

oooh... can we do "-waitfordebugger" there too? that might solve a different question I was pondering last night

weak linden
#

I presume so, yes

torpid girder
#

hello 🙂 i've figured out that characters respawn correctly into the world the second time, I assume there must be something that controls spawning proxy actors into the world

torpid girder
#

is spawning purely managed by the gamemode? there must be something locally that handles the creation of proxy actors

high ibex
#

for skill based matchmaking system, i'm planning to implement openskill algorithm -- wondering if someone has implemented it before. If yes, need help with integration with EOS

torpid girder
#

replicating data is so tricky to do it in the right order

winged badger
#

as long as you keep in mind that every actor replicates via its own actor channel, and there is almost no guarantee of any order

woven basin
winged badger
#

you're generall fine

woven basin
#

i.e. think of packet drops etc - you cant garuntee anything.

winged badger
#

only order of replication guarantee you have is that GameState will have replicated before clients call BeginPlay on any actor

torpid girder
woven basin
#

config? sounds like gamestate? if so - see Zlo's post above - that should help solve your issue

torpid girder
#

i have the rules on a web service, sync between client and server etc is a 🙂

winged badger
#

if they need config loaded, then its not a replication issue at all

#

just ordering stuff server side

#

generally lobbies help, as server gets all the client side information for spawning the client's actors before they even transition into a game map

#

doing any sensible ordering when you just hot drop into an ongoing game directly usually requires c++

#

but as a general rule, your PostNetInit on the PC is the first place you can send a server RPC from and count it will get there

#

some HandleStartingNewPlayer overrides (as well as functions calling it) can get the GameMode not to spawn players until it gets the data it needs

#

or in case of level composition, it can also be used to hold off spawning until the PlayerStarts are loaded

sonic python
#

Guys

#

The Dress of the Client Player is not seen by the Server player and vice versa..

woven basin
#

Anyone here using Oodle for network compression? The sales page says "can compress UDP or TCP packets like nothing else, saving bandwidth for players and servers."

Given its free now - is there any downside to using it?

winged badger
#

there would be minor CPU overhead

#

as it needs to be compressed and uncompressed

latent heart
#

It'll take oodles of cpu time.

#

Leaves

woven basin
#

is anyone here actually using it though? Anyone had any experience positive or negative with it? Or is it one of those things you only need it when you know you need it?

rose prawn
#

And you should show your code or give more details

viral aurora
#

Hi guys, someone here has developed a Replicated Sit System? I'm facing some issues to replicate it

torpid girder
#

Hello, I've got a replication function, I would like to trigger this every time i set chest, even if its the same value

#
DOREPLIFETIME(AAvalonCharacterHero, chest);
#

oops

thin stratus
torpid girder
#

and if i did DOREPLIFETIME_CONDITION_NOTIFY(AAvalonCharacterHero, chest, COND_SimulatedOnly, REPNOTIFY_Always); that should only replicate the values to proxies

sonic python
#

Wait I'll take a SS of the Game state bp

#

code in my game state

#

The Set dress 3 has the logic to equip

rose prawn
#

I see, what are you exactly trying to do? I guess you are trying to spawn dress on players, but who should tell them to do so? Is it happening through UI by player choice or granted by the admin / game mode?

sonic python
#

by ui player choice

#

now theres just this problem that the client and the server cant see the dress the other is wearing

#

I want to know how to fix this

rose prawn
# sonic python by ui player choice

You should change your code completely. After the player selects the outfit from the interface, create a function like Server_OnDressPicked in your character and trigger it from the UI. This function must be Server Replicated and Reliable. Get the Id of the dress from this function, then if you are using a Data Table, pull the information from there and create a variable named Dress and mark the Replication Condition part of it as RepNotify. Set the value of this variable from Server_OnDressPicked function so it can be replicated. You will see a function called OnRep_Dress after you create Dress variable. This is where you put your dressing logic.

#

What you're doing here with my solution is accessing your owning character and firing a server function. This function will set the value of your Dress variable, which is marked as RepNotify. RepNotify functions can trigger OnRep functions whenever their value is changed or the variable is replicated. So you put your dress logic here and when the value changes, this logic gets fired. The reason you wanna put this on your character is to let other players see the changes, because the pawn exists on every player.

weak linden
#

Just to extended on that, static meshes themselves don't and changes of the mesh assigned to a component wont replicate, which means that the actual "SetStatic/SkeletalMesh" call needs to happen on all the client/s and in your case (since you're using listen servers), the host itself

sonic python
#

I'm quite confused

#

Should I replicate the Set Skeletal Mesh?

#

But it affects the player ui choosing

weak linden
#

How are you storing/accessing the "options" of meshes that the players can pick?

sonic python
#

Actually two variables

#

Row name , Category

sonic python
weak linden
#

Okay, so, the UI should call a Server replicated RPC/event to the players character with the RowName and Category as a parameter, this event should then call a Multicast event passing again, those two values as parameters, that event should then do the actual changing of meshes, etc

sonic python
#

Oh it's running on server

#

I had a event called

#

Become active slot which is running on the server in the ui

#

It also sets the variables of game instance and also the function of character bp ( equip item)

weak linden
sonic python
#

No from the game state

#

Wait I'll show a SS from ui

torpid girder
#

when playing on a server and your local character stutters, what is that a sign of?

sonic python
#

Worked for me

#

Okay coming to my problem

#

Now I just want the server and the client to see the dress the other is wearing

weak linden
# sonic python Wrong?

Yes, stuff like this is really bad and should only be used for short periods of time, not just turn it on/off and forget it forever 😅

sonic python
#

Ah dammit

#

So what should we do?

weak linden
#

If it's a game that doesn't really matter if cheating happens, then okay, but in most cases it's really not a good idea

sonic python
sonic python