#multiplayer

1 messages ยท Page 639 of 1

severe tendon
#

So I've created a replicated skeletal mesh and assigned it via a Server RPC, based on what you're saying thats the way to do it

#

Then I pass that through on Multicast

silk abyss
#

you should check but usually you just need to pass "who own the call, who own the mesh, and what I am doing now"

#

the motion controller hands are kinda special case?

severe tendon
#

So I could just pass a reference to the actor as self and then on multicast get the skeletal mesh and set its morph target?

silk abyss
#

I wound't go as far as saying it's special case but they do have special syncing for that component compare to other pawn components.

#

eh, actually don't need to do that.

#

let me quickly explain

#

the playercontroller class have a mirrored counter part on the server

#

so each client have a client controller, and server have all the mirrored playercontollers(think of it like a remote control receiver)

#

it's a one to one relationship that's also the basis for all RPC things to run

#

so you just need to know which player controller owns the current RPC call and sends request to server

#

server tells other clients to do "this face" cause I got a request from player A

severe tendon
#

Thats the easy part

silk abyss
#

what it does is it tells the server pawn that player A owns

#

to replicate the face values(blend values) to all other clients.

#

since that pawn also exists on all other player's local copy

#

(BUT, the actor reference won't be the same if you compare them.)

#

I hope this make sense. @severe tendon

severe tendon
#

Kinda
I'm aware of how UE4 handles spawning and actors I was just lost on why the lip-sync actor wasn't replicating.
Turns out if you send the packets out of order by not forcing Reliable then you get either nothing or random jank ๐Ÿ™‚

silk abyss
#

that's where you need sort of input "queues" and do input reject/replace and smooth interpolation.

#

it's a whole different kind of ball game but if you look for a blizzard GDC presentation about player inputs it should get you started

severe tendon
#

Enabling Reliable fixed it

#

Yeah

silk abyss
#

yeah, if you have like only a couple players that should be fine.

severe tendon
#

I've written C++ based networking, its just getting around Unreals networking that is a struggle

silk abyss
#

but Epic says, "don't abuse reliable flag" so I have to say that.

#

so good luck. ๐Ÿ™‚

tough gyro
#

how do people do client side prediction (predicting local input) without waiting for server to reply first? I figured I could simply do:

  1. ClientDoFoo - owning client does some action and calls ServerDoFoo if not authority (client still does t he action and predicts it can do it)
  2. ServerFoo - simply calls MulticastFoo so that every other client runs the Foo action and all the related effects and such it might contain
  3. MulticastFoo - Now this runs on server and all clients. But now the owning client runs the same action twice? ๐Ÿค”

I'm not sure if a simple HasAuthority check works there in the multicast because then all clients wouldn't execute the action on the actor? Should I check if it's locally controlled instead? ๐Ÿค”

bitter oriole
#

You're correct, except 3 needs reconciliation to decide what's been shown, whether the server showed something different etc

tough gyro
#

so basically I'd need to think of the locally predicted action as a transaction that gets rolled back in the multicast if the server says no can do

bitter oriole
#

Yeah

silk abyss
#

it's like in games if you happen to have network glitch, you usually have these kind of thing happen. 1. gun fire won't stop or can't trigger you can't move at all 2. you can fire or do things and run around but all the others are running in circle spinning, then suddenly rollback to whatever server tell you to.

#

just remember that whatever happens on client side is just visuals, and we try to make it as in sync as possible.

tough gyro
#

I guess this is exactly the kind of stuff the gameplay ability system does?

silk abyss
#

sorry, I am totally out of loop of that gameplay ability system as I just came back.

#

(like my last project on my disk is from 4.15. ha!)

normal jacinth
#

How do you guys replicate audio? Have a function in something like GameState that Multicasts to all clients?

silk abyss
#

I think the general way is to replicate the event that triggers the audio and let the replicated actor handle the part that spawns the audio.

sinful tree
silk abyss
#

there is another side of it as well like, if you are on the client, you want to play the audio asap from your action instead of waiting for the replication.

#

(as that will kinda masking out the perception of input lag, etc.)

normal jacinth
#

makes sense

silk abyss
#

so yeah, will dig GAS as well later when I have time. ๐Ÿ˜›

steep flame
#

If you import your Skeletal Mesh to your Project and choose to use an existing Skeleton in the Project, does the Skeletal Mesh uses the Skinning from the chosen Skeleton or the one Skeleton within the FBX you imported?

steep flame
#

oh ups, myB, but thanks

upper lynx
#

hi everyone

#

got 2 actors in a word, and a weapon pickup

#

I've setup the code to only make the player jump if he runs into it, just for testing

#
    UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepHitResult)
{
    Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepHitResult);

    if (Player)
    {
        UE_LOG(LogTemp, Warning, TEXT("Weapon : %s"), *OtherActor->GetName());
        PickupWeapon_Implementation();
    }
}

void APickup_Weapon::PickupWeapon_Implementation()
{
    Player->Jump();
}

bool APickup_Weapon::PickupWeapon_Validate()
{
    return true;
}```
#

the parent pickup class, just Casts the OtherActor and saves it to a ACharacterBase* Player variable. that all works fine

#

my question is : the UE_LOG in the OnOverlapBeing method, prints out the Actor name for the actor running into it, then the other actor, then the main actor again

#

eg:

#

Base is the parent class, and Weapon is the class from the code example above

#

so I have 2 questions basically : why?

#

and also : should I check if the player IslocallyControlled before attempting to pickup the health?

#

then ask the server to give the health?

#

if I do a if (Player && Player->IsLocallyControlled()) then the server code still gets executed and only once, so I'm assuming all is ok?

meager spade
#

well overlaps are done on both client and server

#

and the name on server will be C_1 and client will be C_0 (if you have only 1 client)

#

so not sure i see the issue here?

#

@upper lynx

dense zodiac
#

hey, I am trying to make a multiplayer game with Chaos Vehicles. It's kinda working out of the box, but since physics is getitng replicated on the server, the vehicles are lagging on client side. If my ping is high, I cannot even control the vehicles. What is the proper way to fix this? (with blueprints)

winged badger
#

physics, networking and blueprints is a combination that just doesn't work

upper lynx
#

thank you ๐Ÿ˜‰

upper lynx
#

thanks for the feedback

grand spire
#

Hey lads! Can GPU affect rubber banding?

silent valley
#

If a client is running at a low framerate (due to GPU or game performance) then it will likely see more corrections.

potent cradle
sweet marsh
#

Hi guys,

I've been trying to get a simple multiplayer up and running and have run into some issues, here's the brief of what i am trying to achieve:

  • players join the server and are made spectators looking through a specific game world camera
  • Upon hitting X spectators in the server the match begins
  • A timer pops up on screen and counts in the round, players can then move and there is a countdown from x which ends the match
  • Players return to spectators looking through a specific camera

So so far i have most of this working with the following setup

#
  • The game mode handles players joining, setting them to spectators
  • The hud reflects the current number of spectators by asking the gamestate about its replicated values (current spectators etc)
  • When the correct number of spectators are in game the game mode starts the match
  • This spawns the players automatically startMatch()
  • The game mode owns the game timer and the game state has it's own version which clients have access to
  • The game mode activates it's game mode timer and is registered for delegate feedback (timer end etc)
  • This then replicates its state to the game state timer causing it to start
#

Now the issue i am seeing here is there is always a delay prior (1- 3 seconds) to the clients game timer starting, now realistically this isn't a big deal as the game mode (server) handles the stopping of the match as it is the only class tied to delegate callbacks from the game timer. But it seems odd, its almost like the game starts quicker on the host than the clients. One big thing to mention here is i am testing in the editor (not sure if this makes a difference).

Does anyone have any suggestions why this might be happening, or alternatively suggestions to the setup, i let clients have their own game timer so it ticks smoothly and the game doesn't have to replicate the time continually, rather just the start, stop etc.

I would appreciate any info on good practices for gamemode vs gamestate. i've read a lot of descriptions, cedirc's multiplayer compendium, multiple tutorials but i still wonder best approaches. I've tried multiple ways where the gamestate (server) owns the timer and handles starting based on match start.. but it seems more sensible to have that type of logic in gamestate.

Anyway any help would be appreciated.

#

oh and fyi this is all in C++

meager spade
#

you need to synch the times

#

at least once from the server to clients

winged badger
#

alternative is using replicated server time in gamestate, but its less accurate

normal hatch
#

does anybody here have experience with implementing in-game economy, meaning that players can sell in-game items between ech other?

bitter oriole
#

Not exactly easy stuff there

sweet marsh
#

@meager spade @winged badger Thanks guys, do you mind elaborating a little on how that would work?

winged badger
#

client sends a RPC with its timestamp

sweet marsh
#

I was thinking firing the timer to start at the same time would do the trick (the clients version is just for show_

winged badger
#

server replies with RPC with original client timestamp and its own timestamp

#

time when client receives the reply - original client timestamp is round trip time

#

so then server delta is servertimestamp - receilvedresponsetimestamp + half round trip

#

you cache that and afterwards when you want to get server world time, you just return your own world time + serverdelta

violet sentinel
#

Hi. I'm trying to setup vehicle passengers system for multiplayer use. My current prototype looks as:

class AMyCharacter : ACharacter {
   UPROPERTY(ReplicatedUsing=OnRep_ParentVehicle) 
   ADriveablePawn* ParentVehicle;
   UPROPERTY(Replicated)
   int32 VehicleSeatIndex;
}

AMyCharacter::OnRep_ParentVehicle() { 
   if (ParentVehicle)        AttachToVehicleSeat(); // attaches character to seat socket
   else                      DetachFromVehicleSeat(); // detaches character from seat socket
}

class ADriveableVehicle : APawn {
   UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly)
   void Board(AMyCharacter* Character);
   UFUNCTION(NetMulticast, Unreliable)
   void BroadcastBoarding(AMyCharacter* Character, int32 Seat);
   UPROPERTY(Replicated)
   TArray<AMyCharacter*> Passengers;
}

ADriveableVehicle ::Board(AMyCharacter* Character) 
{
    int32 SeatToBoard = FindEmptySeat();
     // register passenger within vehicle
     Passengers[SeatToBoard] = Character;
     // register vehicle within passenger
     Character->ParentVehicle = this;
     Character->SeatIndex = SeatToBoard;
     Character->AttachToVehicleSeat(); // attaching instantly on server
     // triggering for other players
     BroadcastBoarding(Character, SeatToBoard);
}
void BroadcastBoarding_Implementation(AMyCharacter* Character, int32 Seat)
{
    // teleport to the boarding location
    // play animation 
}

Do i need to wait on animation finishing on server and then attach it to the seat or do it only on client-side
Are there any possible tips/hints on how to set it up or what should i look at?

sweet marsh
#

Ok, that all makes sense, however as the timer is purely visual on the client would i need to do this? As when the server triggers the timer to start it should be synced right? as in it happens on client and server at the same time. If not would i have to tell the server to start their timer the server delta after it has told clients?

normal jacinth
#

I'm having trouble replicating the Set Anim Instance node; the usual methods of replicating variables and RPCs aren't working. Any thoughts on this?

brittle tulip
#

I've just tried to implement a Sprint movement to the character movement component. It works but now as an autonomous proxy it seems to be like it is correcting my movement even though on the simulated proxy it is smooth. can anyone tell me why this could be occuring? Thanks

Edit:
Lots of network corrections.

Edit the Second:
Don't let resharper name your parameters because you wont realise the difference between InDeltaTime and DeltaTime

bronze arch
#

Anyone experienced overlapping collision (beginoverlap and endoverlap) sometimes not work on server?
its like random time. when i come closer to temple, as expected HP filling is work. but when randomly closer to temple sometimes not work. then i gonna get far and come closer again, then its work.
I used print string. as from log says begin overlap text didnt printed. when i was trying far/closer again, then it printed succesfully.
-No collision changes
-No small collisions
-No fast moving
-Using overlapall profile.
-Using query only collision enable (since i dont use physics so)
Then why this happens?

shadow hornet
#

Has anyone had experience using seemless travel in a packaged game? I have everything working fine in standalone version in editor, but when I package the game nothing happens. I've added the transition map and map to travel to both in packaging.

eternal briar
#

I am using seamless travel, it is working for me in the packaged game

shadow hornet
#

are you running it via console command node?

silk abyss
eternal briar
#

Like opening the level using console command with additional options?

#

Then no, I am using servertravel function

shadow hornet
#

Yes @silk abyss It is set up and working fine when I run the editor in standalone. I can travel to and from and all my items saved, etc but for some reason when I export the game, I run through the trigger box and the node fires but I am not sent to the other map like I am when running in editor standalone mode

#

the only difference is exporting

silk abyss
#

@shadow hornet are you sure you set your game mode and other default blueprints proper for your export?

shadow hornet
#

ya, game mode is set in project settings and Im running the command on game mode via custom event replicated and run on server

eternal briar
#

@shadow hornet have you added the map you are opening in the packaged maps list in packaging settings?

bronze arch
silk abyss
#

if you have print or log functions, try log those to log file and then check log for your packaged game.

shadow hornet
#

@eternal briar Yea, I thought it was because my transition map wasn't added yet but I added it also and still same.

silk abyss
#

cause server should try do something and log plenty other default information to log file

eternal briar
shadow hornet
#

all my maps are listed in the "Directories to include" with proper location

#

not yet, i'll look at that.

silk abyss
#

@bronze arch basically, it's tough to call but 10~20% is a bit much isn't it? it sounds to me that something doesn't seem quite right and probably have logical error in your server authenticate event flow.

#

like maybe you have a data race and set the flag wrong somehow.

bronze arch
#

like depends framerate Thonking

silk abyss
#

so something to do for checking? on the server log the actor/component that should generate events.

bronze arch
#

for testing

#

im using 4.24

silk abyss
#

see how you can replicate that and if you think frame rate could be an issue, do client side check and request a server overlap check.

#

doesn't matter which verison, overlap event is there for a very long time.

#

it's how most "pick up" works, so you overlap ammo/gun, you pick up ammo/gun

#

also, who is actually doing the call?

#

isn't these all be done on the server?

bronze arch
#

its like when fps drops coming it doesnt print more chance to not fire overlap event %50 (maybe GC?)

silk abyss
#

so on both server and client, you add to pawn health?

#

(after overlap I mean)

bronze arch
#

for test used just print text. but in normally yeah im using pawn health for filling HP from temple

shadow hornet
#

@eternal briar I got it. It was the transition map not being added originally to my export map list. For some reason after I added it, it still hadn't taken in settings so when I exported it wasn't there. After restarting the project and exporting again it worked this time. Ty for the help though..

silk abyss
#

@bronze arch okay, just kinda double check. what component on the player you used to generate overlap events with the temple?

#

you said something like even if you run locally it will still have lower chance of not firing event, that is super weird.

bronze arch
bronze arch
silk abyss
#

is your actor always spawn outside of the temple shpere?

bronze arch
#

while GC deletion

silk abyss
#

can you do a test, say, you set your max fps to like 15 or 10

#

then try that.

bronze arch
#

maybe 30 min later maybe 1hr maybe 5hr

#

atm looking for another method to prevent this,

silk abyss
#

is your temple sphere overlap everything or just pawn?

bronze arch
#

because I thought someone had the same trouble, maybe there is a solution.
guess im gonna delete those events and using getoverlappingactors within Set Timer

silk abyss
#

there are so many overlap not working issues on the internet man.

bronze arch
silk abyss
#

try make it overlap only pawn

#

ignore others

bronze arch
#

if not ill go with settimer

silk abyss
#

well, take it as a lesson to figure why.

#

cause if you can't figure this out, most of the trigger box mechanism will bring you trouble.

bronze arch
cursive magnet
#

how to do a lobby ? currently my ame don't have lobby when join game

severe tendon
severe tendon
#

Are you using a subsystem?
Like the Steam subsystem

cursive magnet
#

advanced sessions

#

a free plugin

severe tendon
#

Yeah, so the sessions system

#

Ok so I can't really write anything at the moment but a lobby is just a pre-match menu.
So at a base level what you can do is join everyone in and then force their camera or add a UI overlay and disable inputs.

#

I thought you were using C++ and had direct access to the online subsystems, which is why I was talking about Oculus, that plus they have a good example of hosting/joining sessions and lobbies

cursive magnet
#

i use BP

severe tendon
#

Yeah
so just create a multiplayer match and force users into an empty or pre-designed level with a UI and enable UI and mouse

#

disable controller inputs

cursive magnet
#

yeah but i need to save in real time player info and show them on the lobby

severe tendon
#

Dunno how good it is though

#

But you should be able to get player info on the client side and send it to the server on connect to then create a widget across all clients and fill it with that info

neat depot
#

Hey, guys! I have a couple of newbie C++ multiplayer questions.

  1. When declaring a Server function with a parameter, like this...
UFUNCTION(Reliable, Server, WithValidation)
void ServerGrab(AActor* GrabTarget);

...and invoking the function from a Client, will the AActor* GrabTarget parameter still be referring to the same Actor when the ServerGrab_Implementation function is called on the server side? It is almost impossible for the Actor to be in the same memory address in both the server and client, so does Unreal take care of this behind the scenes and converts the value of GrabTarget so that it points to the same Actor that the client intended?

  1. Are _Implementation functions static? In the ServerGrab example above, I end up with a void ServerGrab_Implementation(AActor* GrabTarget); function in my CPP file. I tried to use this->GetMesh(); in that function's body so I could attach the grabbed actor to my Character's SkeletalComponent, but Visual Studio is saying "'this' may only be used inside a nonstatic member function". Is this one of those situations where Visual Studio gives a nonsensical error because it doesn't know how Unreal works, or are _Implementation functions actually static?

Thanks!

winged badger
#

unreal doesn't replicate memory addresses, it replicates a NetGUID that gets resolved into a pointer on the other side

#

and _Implementations are definitely not static by default

#

i don't think your problem is likely a static, but a non-member, because you likely forgot the bolded part of void **AMyCharacter::*ServerGrab_Implementation(AActor GrabTarget)

#

(in your .cpp)

neat depot
#

Thanks for the reply! I tested my function (it still compiled despite Visual Studio's error) and you are right about _Implementation functions not being static! CrashThumbsUp I put a breakpoint in the line where I call this->GetMesh() and it does work. (I only forgot to put AMyCharacter:: in my message, not in the actual .cpp file).

#

It's really cool that Unreal replicates the NetGUID instead of the memory address. CrashThumbsUp

#

Yeah, that's what I figured... Since this was a new error than the ones I usually get from Visual Studio I thought it might have been a real one this time, but I guess it got confused because there's no _Implementation function in my Header file.

#

So thanks, you two! And nice cat in your avatar, Lorash!

meager spade
#

it cant really replicate a memory address tho

#

that would never work ๐Ÿ˜„

silent valley
#

Is it possible to rely on a CDO pointer replicating reliably? Or do we need to make sure the clients/server have loaded the class first?

#

Or maybe I should replicate a TSubclassOf instead?

empty axle
gleaming vector
#

CDOs are replicated by name

#

if UObject::IsNameStableForNetworking returns true, then UE4 will replicate by name instead of netuid

#

IsNameStableForNetworking returns true for assets, CDOs, and constructor-created components

#

so, short answer is, replicating a TSubclassOf (under the hood, a UClass*) and a CDO is the same

#

they are both replicated by name because UClass is name stable and CDOs are name stable

#

it is worth it to note, neither UClass pointers or CDOs are evaluated for property changes

#

only things replicated by an actor channel are evaluated for property changes (so, Actors, Components, and UObject instances explicitly replicated with UActorChannel::ReplicateSubobject)

empty axle
#

Good to know

gleaming vector
#

yep

#

these rules bit me in the ass when writing my plugin ๐Ÿ™‚

#

and I'm currently fighting with ReplicateSubobject right now, since it's delayed a frame

silent valley
#

that's some good detail thanks ๐Ÿ™‚
but do you know if I replicate a CDO, internally UE will convert to NetGUID and send that. But will it load the class on the receiving end and provide a valid pointer?

gleaming vector
#

so, again, it's replicated by name

#

not netguid

silent valley
#

ah sorry yes ๐Ÿ™‚

gleaming vector
#

(the name in this case is not a string, but a different identifier)

#

UE does not attempt to resolve the object on the other side. It just returns whatever UObject* corrisponds to that name

#

so if you replicate like BP_MyBlueprint_C, it will give you whatever is named that object on the other end

#

so, if you load that object beforehand and the name matches what the server has, all is good ๐Ÿ‘๐Ÿฝ

#

if no object exists by that name, you get a warning and nullptr

#

if a different object exists by that name, there is hilariously no checking

#

it just returns that object

#

(dont ask how I learned there was no checking... that was the bit that really got me when writing my plugin)

upper lynx
#

morning guys. I have an ActorComponent with a method that handles HandleTakeAnyDamage

#

when I'm done updating the health, I then OnHealthChanged.Broadcast(this, Health);

#

on my BP I have this

#

The value comes through correctly, but it's Server Only

#

so when I try and update the UI, it doesn't update, cause it's only happening on the server, and not the client

#

how do I fix this?

gleaming vector
#

replicate health to clients

#

you want a replicated property here

upper lynx
#

I've set the var to Replicated

gleaming vector
#

set it to RepNotify

upper lynx
#
    float Health = 100.0f;```
gleaming vector
#

right

#

so you want a notify here as well

#

because you don't just want the health to be replicated, you want to know when server has changed it

upper lynx
#

like this? UPROPERTY(ReplicatedUsing = Rep_HealthUpdated, EditAnywhere, Category = "Health") float Health = 100.0f;

gleaming vector
#

yep

upper lynx
#

tried that too

gleaming vector
#

when Rep_HealthUpdated is called, update your UI

#

though, personally, I use UMG bindings to do stuff like this

upper lynx
#

ahhhh

#

so I should make UFUNCTION(BlueprintCallable) void Rep_HealthUpdated(){}

gleaming vector
#

not BlueprintCallable, but yeah

#
UFUNCTION()
void Rep_HealthUpdated()
{
 //Update your UI with the newly updated value
}
upper lynx
#

ok, I had it first without the BlueprintCallable, and didn't work either

gleaming vector
#

no, you need the UFUNCTION(), you don't need the BlueprintCallable

upper lynx
#

cool

gleaming vector
#

UFUNCTION() with nothing just marks the function as a UFunction

upper lynx
#

also, I thought you didn't need to put anything inside the Rep_HealthUpdate function?

gleaming vector
#

which is what you need

#

nah, you need something there

#

so, conceptually

#

Actor takes damage, health is decreased on the server

#

it changes Health, sends the change to the clients

#

the clients now, when it sees that the Health value changed, do something with the new value (update the UI with that)

#

you have the taking damage and the replicating to the client

#

the client is just doing nothing with the value change

#

Rep_HealthUpdated() is where you actually respond to that change on the client

upper lynx
#

right, makes sense

#

ok, let me mess around here a bit

#

thanks

gleaming vector
#

no problem!

#

also, it's worth to note, personally I do not follow this pattern

#

in UMG, there is a binding feature, and I bind UI values to replicated variables

upper lynx
#

yeah I know there's the bind function, but I've read that this is not always the prefered method. It works, but something about it being expensive

gleaming vector
#

yeah, it can be slow

#

it's called every frame

#

and your health probably wont change every frame

#

so it's not the best

#

but I like binding conceptually because I treat my UI as a "View" in a MVC pattern, and having your data know about the view is kind of a anti-pattern there

#

it does have performance considerations

kindred widget
#

It really depends on the value and how you use it. It's fine for a few small things. But some people put bindings in places like lists. And if you have like.. ten bindings per list button, and then you start populating that list with a hundred buttons, you now have a thousand bindings.

upper lynx
#

ARGH@#!@# !@!@# HOTRELOADS!!!!

#

ok, will feedback shortly if it works

#

need to restart and rebuild BP

kindred widget
#

Should ditch hotreload too.

gleaming vector
#

yeah turn off hotreload lol

upper lynx
#

what? I can do that?

#

awesome

kindred widget
#

Just enable Livecoding.

#

You don't have to use it, but it'll stop Hotreload from running. And if you change things in the .h file or class constructor, always reload the editor.

upper lynx
#

what is so frustrating, is that every time I make a change to the ActorComponent, then that component goes blank on the BP

bitter oriole
#

Welcome to hot reload with Blueprint changes

#

Don't compile with the editor open if you are doing UPROPERTY/UFUNCTION/constructor changes

upper lynx
#

I have this on my variable

#

UPROPERTY(ReplicatedUsing = Rep_HealthUpdated, EditAnywhere, BlueprintReadOnly, Category = "Health")

#

but for some reason, the Rep_HealthUpdated() method is still not being called when updating Health variable

#

full text

#
    float Health = 100.0f;

    UFUNCTION()
    void Rep_HealthUpdated();```
#
{
    UE_LOG(LogTemp, Warning, TEXT("Rep_HealthUpdated %f/%f"), Health, NewHealth);
}

void UHealthComponent::HandleTakeAnyDamage(AActor* DamagedActor, float Damage, const UDamageType* DamageType,
                                           AController* InstigatedBy, AActor* DamageCauser)
{
    if (Damage <= 0)
    {
        return;
    }

    NewHealth = FMath::Clamp(Health - Damage, 0.0f, MaxHealth);
    Health = NewHealth; 
    
    UE_LOG(LogTemp, Warning, TEXT("HandleTakeAnyDamage %f/%f"), Health, NewHealth);
    
    OnHealthChanged.Broadcast(this, NewHealth);
    
}```
#

surely if the Health variable is update in HandleTakeAnyDamage, then it should call the Rep_HealthUpdated method?

#

and yes, I have ```void UHealthComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);

DOREPLIFETIME(UHealthComponent, Health);
DOREPLIFETIME(UHealthComponent, Shield);

}```

silent valley
#

Assuming you have called HandleTakeAnyDamage() on server, then you should see the Rep_HealthUpdated() being called on Clients (but not the server)

upper lynx
#

not seeing it anywhere

empty axle
#

Also the component have to be set to replicate, the same goes for the owning actor

upper lynx
#

OnHealthChanged broadcast to the BP shows that it's being called on the server

upper lynx
#

that's the problem

#

component wasn't set to replicate

#

argrrggggghhhh

#

thank you

ember needle
#

Does anyone know whether the NetworkPrediction plugin is here to stay and it's worthy investing time in it? Last updates are relatively recent (7 months ago) but many comments in code give the hint that this is yet to be optimized / solved, but I might be wrong.

tough gyro
#

my guess is that it was a test bed / WIP of whatever UE 5 will have

#

I also have a question: Was there any built in way to have replicated simulated physics?

#

I think there was a plugin for it ๐Ÿค”

upper lynx
#

with new power, comes new responsibilities problems

#

2 clients.

Client 1 gets hurt - Can see the updates on client1 and on client 2. So all good there

Client 1 picks up health pack - ONLY client 2 is aware of this.

empty axle
upper lynx
#

dedicated

empty axle
#

Show us how the health pack works

upper lynx
#
    UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepHitResult)
{

    Super::OnOverlapBegin(OverlappedComponent, OtherActor, OtherComp, OtherBodyIndex, bFromSweep, SweepHitResult);
    
        //Player is set by the parent of APickup_Health, namely APickupBase
        //Returns valid
    if (Player)
    {
        PickupHealth_Implementation();
    }
}

void APickup_Health::PickupHealth_Implementation()
{
    if (Player)
    {
        ACharacterController* Controller = Cast<ACharacterController>(Player->GetController());
        if (Controller)
        {
            Controller->GivePlayerHealth(HealthAmount);
        }
    }
}```
#

ACharacterController class

{
    if (HealthAmount > 0)
    {
        CharacterBase->GetHealthComponent()->GiveHealth(HealthAmount);
    }
}```
#

I made the health pickup run on the server, so that the server is the only one that has the auth to give the health.

potent cradle
#

Using C++:

If I add or remove items to/from a nested TArray on a replicated TArray<FMyStruct>, does the onrep still trigger? ๐Ÿค”
Stuff like this is an issue in Blueprint, wondered if this was also a limitation in C++?

E.g. a class has a replicated (onrep) TArray<FMyStruct> MyProperty below:

struct FMyStruct
{
    TArray<FMySecondThing> Things;

    void AddItem( FMySecondThing Thing )
    {
        Things.Add( Thing );
    }
};

And I do MyClassReference->MyProperty[0].AddItem( NewThing ).

empty axle
empty axle
#

Oh you mean OnRep for the whole structure if the inners are changing, then I am not sure if it is called

potent cradle
upper lynx
#

check the console log

#

the first few where the numbers going down is when client1 gets hurt. you can see the health bar is being updated on both clients

#

at the end, when client 1 picks up health, only client2 gets the 100

#

strange

#

anyways

#

I'll dig around some more

dark edge
#

@upper lynx that's a problem with your logic between triggering the pickup and actually adding the health.

upper lynx
#

it's working now

#

I was calling _implementation directly.

#

I understand now why that was incorrect

#

thanks

potent cradle
#

Praise be C++

chrome bay
#

Yeah if the array or data within changes at all it'll fire

scenic turtle
#

Hi all, can please someone with Firebase Database experience in connection to multiplayer drop me a message, I have a couple of questions. Thanks in advance.

potent cradle
chrome bay
#

Yeah the blueprint callbacks suck big time. They aren't really OnReps either. No idea why Epic decided to use totally different logic for BP.

lapis epoch
#

Hi anyone have any good source on advanced network concepts applied in unreal?

#

I'm familiar with gafferongames, valve client side prediction paper etc., but looking for anything applied in unreal

#

ah that sounds great, I'll check it out

#

sorry a bit new to this, where is it pinned?

#

also, do you know if it covers more advanced topics like how to handle client side prediction etc. in unreal?

chrome bay
#

Gaffers' article is hard to apply to UE tbh, due to the nature of it.

lapis epoch
#

ah found the ๐Ÿ“Œ , thanks!

#

@chrome bay yeah, getting that impression as well

chrome bay
#

Prediction stuff is usually very specific. Epic has "general" support for it in Gameplay Abilities, and there's an upcoming network prediction plugin that will help with custom movement and interop with gameplay abilities too.

lapis epoch
#

yeah, I've dabbled with my own implementations of client side prediction myself so aware of the "specific" nature of it

#

would still want to know how you'd handle something like a moving platform in unreal

#

upcoming network prediction plugin sounds great, is there any info on this, or just soon โ„ข๏ธ

#

Anyway, I'll do some more digging. Thanks for the info, it's very much appreciated!

eternal canyon
#

its just not finished

#

yet

chrome bay
#

Yeah, best bet is to check master branch but it hasn't been updated for a while. Probably being done internally now for UE5

eternal canyon
#

doesnt do much tho

chrome bay
#

Ahh nice, that's good then

eternal canyon
#

yea

eternal canyon
#

there still working on a lot of it so its not really ready for a shipped build

chrome bay
#

Still some physics stuff going on too, that's exciting

brittle tulip
#

I'm a noobie to the whole multiplayer replication stuff. I have a sprint system which will reduce stamina by x amount every tick. Should I be doing this with a rep notify or should i just write something along the lines

/* In the tick() */
if (GetLocalRole() == ROLE_Authority)
  CurrentStamina -= 1 * DeltaTime;

Docs seem to say rep notify but they don't do their example every tick.

cursive magnet
#

hi i use free plugin advanced sessions for create game lobby

#

but look like when i quit the lobby for return to main menu

#

my lobby is still present on the list

#

and only dessapear when i quit the game

#

what to do ?

#

how to close this session ?

craggy void
#

Use the DestroySession method

#

You'll also need to call it on clients otherwise they can't join a new session if the host quit or they got disconnected

cursive magnet
#

i need to paly this function on all clients ?

#

it is a advanced session method ?

#

how to play it on all users ?

craggy void
#

Just make a SessionActive boolean on your game instance and set it to true if you start or join a session. And if you're back to the main menu (because you left the game or got kicked/disconnected) you call DestroySession there if SessionActive was true. And then just set it to false again.

cursive magnet
#

So i need two functions

#

one for host like my screen ?

#

one for clients who kick or disconnect

#

@craggy void

#

bc currently that don't work even for me

craggy void
#

If your host terminates the session, the clients get redirected to the default map automatically

#

So if you set MainMenu as your default map, and do the DestroySession there if a session was active, you'll always close the session properly no matter the reason

cursive magnet
#

the code on the screen don't lcose the session

#

that still on the game lobby list

craggy void
#

Hook up the player controller

cursive magnet
#

not owning?

#

and first destroy session then load scene?

craggy void
#

Like I said, I just change the level and destroy the session in the MainMenu

cursive magnet
#

so on main menu event construct

#

destroy session ?

#

currently i load the map so i m on success

#

but game still on lobby

#

here ?

#

or here

#

@craggy void

craggy void
#

I would imagine either would work

cursive magnet
#

ok but on widget i need to use get owning player

#

and not get controller

#

i did this

#

don't need get instance variable

#

because if true he destroy

#

if false he failured

#

but failures isn't a problem

#

@craggy void

#

but does that will work for people who are not the host of the server?

craggy void
#

I suppose that would work yeah, I just don't like executing code unnecessarily because it might cause side effects

cursive magnet
#

ok but here what side effect can happen

craggy void
#

That's the thing, you don't know that in advance. Might completely crash the game if there's no session under certain circumstances for all you know

cursive magnet
#

xd

#

but so this dsetroy sesion thing

#

for a client that don't destroy the server

#

but only left his place on the server

#

and for the host that destroy the server.

craggy void
#

No, the session is local. So if you call DestroySession on a client it basically exits the session gracefully

#

Won't kill the server's session

cursive magnet
#

ok only kill server if you are the host ?

#

@craggy void

craggy void
#

Yeah

cursive magnet
#

ok

scenic turtle
#

Anybody used Firebase backend for a multiplayer project? Also, I know it might be a pointless question( I am still pretty much new to networking ), but is it possible to connect clients to a database server, without having a dedicated server build for the game? So for example clients position is updated from the database? Thanks

thin stratus
#

Even if, Firestore costs per Read. You really don't want them to constantly read and write to it :D

potent cradle
#

Anyone using UseAdaptiveNetUpdateFrequency? Just found about about it

#

Wondering if it's hot or not

cursive magnet
#

What MP solution you can use except the Advanced Sessions plugin ?

scenic turtle
thin stratus
#

With a lot of work maybe, not sure

waxen socket
#

Hello, I have a question about rotation replication.

It would appear that SetControlRotation only functions when called on the owning client, eh?

Does anyone know a way I can instead call it on the server and have it replicate out? I'd like to do this so that I can handle it in the same place where I'm calling SetActorLocation at that moment.

Any advice would be appreciated.

Cheers.

scenic turtle
cursive magnet
#

lilke what

#

dunno what we have

waxen socket
#

You're right, controllers and the pawn they currently possess are owned by the client. By using Control Rotation, you can rotate a pawn via the controller.

silk abyss
#

(ie you can kill a pawn on the server but not on client, if you somehow C++ kill it locally it won't reflect to other clients anyway.)

kindred widget
#

Pawns should be owned by whatever client is possessing them.

edgy valve
#

Hi everyone, is anybody here Good with splines ? I'm experience a weird bug where my character follows the spline as expect but he fly to outside the world after that, i have tried to remove the last Point of the spline, but no success, could anybody PLEASE help me ?

silk abyss
#

na~, imaging this. you have player pawn and vehicle pawn and the air-strike tomo-hawk guilded missile with camera pawn

#

can client own all those? you would be asking for lot's of cheat!

#

server game mode can kick player controller out of their possession anytime, in fact that's how you do lobby/spectate pawn and respawns on the server.

kindred widget
#

The client just possesses the vehicle pawn, or a seat in it, which allows them in input controls through the vehicle.

#

But that doesn't change the point. SetOwner is called on a pawn when a controller possesses it.

silk abyss
#

still, client don't actually own the pawn.

#

I mean the "owner" call is a bit misleading, they should just call it "possessor"

#

whatever is less misleading.

kindred widget
#

Except that they do. because their controller is set as the owner. Anything owned by their controller, they own.

silk abyss
#

that's more like a framework terminology vs who actually have the right to do stuff debate.

waxen socket
silk abyss
#

in server authenticate env, all the inputs are going to server and server "replay" your input and do all the movement on the server.

kindred widget
#

Server calls Controller->Possess. That calls Pawn->PossessedBy, That calls SetOwner and sets the owner of the pawn to it's new controller. Owner is a replicated variable. The client now owns the pawn it just possessed.

silk abyss
#

client can do some sort of prediction but eventually you need to interpolate back to where server pawn currently is

#

that owner variable is just so it's easier to maintain player inputs and relationship to the pawn(s)

chrome bay
#

"Owner" is very much a UE thing and the client does 'Own' the pawn they possess. Without that you would never be able to send RPC's to the Server for that actor.

waxen socket
#

Thanks, Jambax.

silk abyss
#

I just found it misleading by having it named like this

chrome bay
#

You're mixing it up with "Has Authority"

silk abyss
#

like it actually leads to discussion like this one, imagine trying to teach someone replication and they said, but client owns the pawn why I can't do some stuff to it

chrome bay
#

Owner = This player can do stuff and call network functions on this object.
Authority = This actor was spawned on the local machine or torn off, and the instance can do whatever they want to it

#

Ownership != Authority though, that's the key difference. Authority is what determines whether you have the final say on something, and that only ever matters if the Server has authority since replication is one-way.

silk abyss
#

this is what people get so confused with cause the naming. ๐Ÿ˜ฆ

kindred widget
#

It's like having a Steam account. You might own it. But they have authority over it.

chrome bay
#

IDK I'm used to it ๐Ÿ˜„

silk abyss
#

I am used to it but still never liked it one bit

#

like before the compendium out, it's very difficult to convey the idea.

#

(especially like English isn't my native language)

chrome bay
#

Ah, that's probably what it is

waxen socket
#

I hope you find peace, Penguin.

#

Jambax, since you're here...

silk abyss
#

so when I try to explain to someone new, I try to tell them the clients don't actually "own" anything if they are doing game mechanics.

#

but now adays I just tell them to read the compendium(most of time)

waxen socket
#

Before this ownership (which is nine tenths of the law) debate opened, my question was the following. Do you have any advice for me on this issue?

--

It would appear that SetControlRotation only functions when called on the owning client, eh?

Does anyone know a way I can instead call it on the server and have it replicate out? I'd like to do this so that I can handle it in the same place where I'm calling SetActorLocation at that moment.

--

If there's no way to do that, could you tell me if it's safe to disable and reenable ReplicateMovement on characters midgame? I just need to do this little flourish animation when the pawn spawns and then let the player take over.

chrome bay
#

Control rotation is indeed client-side, but IIRC the character movement system sends the control rotation as part of it's movement updates - and the server will just accept the rotation.

#

Effectively client has authority over their controller rotation

#

And APawn has a replicated 'RemoteViewPitch' which is a heavily compressed pitch rotation so that 3rd-party players can see where others are aiming.

waxen socket
#

So calling SetControlRotation on the server won't do anything unless the controller is owned by the server and there's no way to get around that?

chrome bay
#

It'll set the control rotation of that controller locally, but almost immediately after the characters' owning client will send it a new one.

waxen socket
#

Yeah, that's what I figured... So! My other solution, is it advisable to disable ReplicateMovement on a character, move it locally on each client and then reenable ReplicateMovement and reenable input to let the player take over?

chrome bay
#

Tbh I would just play the animation locally and ignore networking altogether

waxen socket
#

So what all would I need to disable to do that?

chrome bay
#

I guess you can disable replicated movement but AFAIK the client will still be sending movement info to the server, unless you disable CMC from ticking too.

#

Then reenable after

#

But you might get a spike or jolt from it

waxen socket
#

It's only for two seconds of timeline animation or so.

#

It will be disabled off screen, fly onto screen, and then reenabled.

#

So if there's a jolt during the disabling, it will be offscreen.

#

But reenabling will be onscreen.

chrome bay
#

Would probably work, just disable CMC tick and replicated movement (which itself is replicated, so needs to be changed on server). Then reenable

#

Not sure though

waxen socket
#

Disable CMC tick on each client, and disable ReplicatesMovement on server?

chrome bay
#

just the owning client

#

Or, better yet, just animate the mesh and disable network smoothing

#

then you don't need to do anything

waxen socket
#

Ah, that sounds good.

#

Wait, you don't mean a skeletal animation? I'm just moving it along a spline with a timeline for my "animation".

cursive magnet
#

they are better?

peak sentinel
#

Advanced Steam Sessions just exposes current engine functions to BP afaik

#

So (again, afaik) none of the session plugins (anything related with steam, eos, discord, anything else) dont add new features/functionalities they just expose the framework

bitter oriole
upper lynx
#

The one thing that always pops up when reading about multiplayer, is ownership

#

that always needs to be what you think about

#

I'm getting the following error
ProcessRemoteFunction: No owning connection for actor BP_Pickup_Weapon_2. Function PickupWeapon will not be processed.

#

I've googled now and tried to fix it, but not getting it right

#

on my CharacterBase class

{
    Super::PossessedBy(NewController);
    SetOwner(NewController);
}```
#

one of the sites I found mentions this:

Because the Actor which invoking server function on client doesnโ€™t have Connection.```
#

so should my pickup_weapon have an owner set?

peak pollen
empty axle
upper lynx
hollow saffron
#

@peak pollen Animations don't network, they should be driven from the animation blueprint by properties that do though. Typically it is enough to set up the animation blueprint to be driven by the velocity at the most basic, which is networked.

#

How is your anim bp set up?

peak pollen
#

its just reading the input from the character movement component

hollow saffron
#

What is AnimMoveInput pulled from

peak pollen
#

ANimMoveInput is just InputX

#

InputX in Character Movement Component

#

In the video it looks like the values are being reset because it prints clients twice and the second one is zeroed out. Server is printed 3 times and last two are zeroed out as well.

hollow saffron
#

What do you mean InputX? The properties of the movement component actually networked is like velocity and such. "input" broadly speaking, is not networked. Can you be more specific where it is being pulled from?

peak pollen
#

Its my own variable

hollow saffron
#

So what is that set from?

peak pollen
#

Just to be more transparent. I am moving through curves that I extracted from animations. I use inputX and inputY play animations. While animations are playing I get the curve. Than I set actual movement to that.

#

I need root motion but it does not work so well networked so I am making a "virtual" rootmotion system.

#

I have seen this done before

hollow saffron
#

It sounds like something well outside the purview of the prediction system, so you are in for nothing but problems in MP.

peak pollen
#

No not really since I am moving using this

CharacterOwner->AddMovementInput(CharacterOwner->GetActorForwardVector(), 1);

#

The movement works fine.

#

Just not being animated.

hollow saffron
#

Anything not captured in the saved move is basically not predictable, and rollback and replay will not function properly. This won't be obvious until you play under more laggy conditions.

#

But anyways, I won't lecture on that.

peak pollen
#

So I should get InputX in the SaveMove section of my code?

#

Sorry I am new to networking.

#

We don't care for the rollback and replay stuff

hollow saffron
#

My advice would be not to try and circumvent the mechanisms built in. It saves moves for prediction and correction. I don't know why you would want to intentionally break that. You are pushing input data that is largely redundant with the information that can be derived from the movement speed.

#

do you need to set bRequestMovementInputChange in your Server_SetMovementInput_Implementation ?

#

looks like you do that on the client side, but the server doesn't

peak pollen
#

No let me try that.

#

Ok that got the clients animating on server window

#

The problem is that the second Client and server print is set to 0. So its being overwritten. That is the problem

#

I did above and now both Server prints say 1

dark edge
hollow saffron
#

He's RPCing the input

dark edge
#

So bypassing all the prediction in CMC? All to make a dude be able to sprint into a wall?

#

Lol

peak pollen
#

I am trying to do something like this.
https://www.youtube.com/watch?v=1VxdxYzriAk

Virtual Root Motion System Preview V1
(No root motion is enabled, no root motion system is used in the engine)

  1. Can be used for dedicated servers
    (Currently, the packet data of the mobile component is increased by 2~4 bytes, and the packet data of the original root skeletal system is N times that of the system)
  2. It can be used for all animat...
โ–ถ Play video
dark edge
#

@peak pollen What do you want to have happen when you press forward but can't move forward?

hollow saffron
#

What makes you think he's networking input to do that?

peak pollen
#

I don't care for that at the moment.

#

Its just a test

#

I know there running into the wall because there player controllers tell them to set Movement X to 1 on start. I do that so I can watch both of them without having to manage one.

hollow saffron
peak pollen
#

I talked to him. He said its not like motion symphony. He is extracting curves from the animations for movement, rotation and such. He told me he is not using motion matching.

#

I am using a tool I bought from him that extracts the same curves that he uses.

hollow saffron
#

I think @dark edge point is if you drive your animation blueprint with RPC'd input properties, running into a wall is going to have them playing the run cycle in place against the wall for as long as you are holding the button. Contrast that to a character stopped at a wall by physics whose velocity is 0 wouldn't be doing that. You are creating problems with this approach. This is going to scale poorly. RPCs are probably the lowest class of networked data

dark edge
#

I mean there's always rpcs being sent but you should animate based on the results, not the inputs. But I guess if it's just for testing then it's no thing

peak pollen
dark edge
hollow saffron
#

Are you replicating MyNewInputX, MyNewInputY ?

peak pollen
hollow saffron
#

sorry, InputX, InputY

#

So client sends input to server, how does it get back down to other clients?

dark edge
#

For a simple test you would just pass input value to server then server would save to replicates variable. That's if you're doing it totally independent of the CMC and just want to see what the inputs are. I guarantee you the CMC will not play nice with replicated inputs, it replicates the input internally by itself

peak pollen
#

In Animation Blueprint I got this

AnimMoveInput = FluidCharacter->GetFluidCharacterMovementComponent()->MoveInputX;

#

I am not using MoveInputX anywhere else.

hollow saffron
#

Server_SetMovementInput_Implementation doesnt echo it back out to clients, so how does it get to them? Is it replicated?

dark edge
hollow saffron
#

your pastebin snippet doesnt show MoveInputX, just InputX so not enough info

peak pollen
dark edge
#

@peak pollen are you passing the inputs on tick or on the move input events?

peak pollen
hollow saffron
#

where are you calling SetMovementInput, can you show the bp

peak pollen
#
    //Movement Input
    UFUNCTION(Unreliable, Server, WithValidation)
        void Server_SetMovementInputX(const float Input);
    UFUNCTION(BlueprintCallable)
        void SetMovementInputX(float Input);

Like you said I am not sending it to the client from the server right?

hollow saffron
#

not in the pastebin unless the variables are replicated

peak pollen
#

They are not

hollow saffron
#

sounds like the problem then

peak pollen
dark edge
#

It's as simple as only setting it IF YOU ARE SERVER then letting it replicate out.

peak pollen
#

Like I said I am new to to networking but I do feel dumb now lol

sullen kernel
#

I noticed that ShooterGame uses uint32 bPendingReload : 1; instead of a bool in the weapon class. Is that a practice that we should follow? That particular variable bPendingReload is replicated but some of the others aren't.

nova wasp
#

usually this is to pack bools together into one int bitflag so they can all get sent over the network/stored at once afaik

#

but I can't tell where they do that here...

#

maybe the property system packs them?

brave wagon
#

Hello, what's are the advantages of a dedicated server in front of using advanced session plug-in with steam?

bitter oriole
#

Dedicated servers are better than listen servers if you need competitive games with anti-cheat, or if you have massive player counts (> 6-10)

#

Unrelated to sessions though

gentle pagoda
#

Hello I am first time trying a multiplayer game I am successfully connected to a pc over lan. But not able to connect via internet with a friend

#

Steam pop up is coming and I have used advance session plugin

#

Can anyone please help?

#

Please it's urgent

craggy void
#

Are you using your own app id or the spacewar 480 one?

nova wasp
charred marsh
#

Hi guys ! Do you know how to get the local PlayerController from a client session ? I'm trying to color the outline of other characters in blue or red depending if they are enemies or allies. For that I need to get the PlayerController of the instance to get the team of the player. (If you would do it in a different way I would be happy the hear it) ๐Ÿ™

#

GetPlayerController works just fine ! You rock thanks !

winged badger
brittle tulip
#

Hey, I have a UObject which inside holds an array of character references. I'm using an actor (other than the player character) to spawn these characters and then adding them into this uobject. I'm spawning the spawn actor and charcters in a server RPC within the player character, but can't seem to get a reference back for the UObject. Is this because UObjects cannot be replicated and how can I fix this?

dark edge
#

@brittle tulip why are you using an object for this and not making it some property of the game mode or whatever?

brittle tulip
#

also players will have multiple of these Units (the UObjects) that will form an army which will also have functionalities. If that makes sense

gentle pagoda
harsh cargo
#

Hey guys, my game has people connect to a friends pc to use there pc as like a server, and i want to do it so I can change maps. I'm trying to do server travel but nothing seems to be working, except a slight jitter when i go through the overlap

craggy void
# gentle pagoda I am using spacewar 480

The spacewar id is region bound I believe, so doesn't always work if your friend is in a different steam region. Does it work when you're on a different PC in the same network?

craggy void
harsh cargo
#

Ah okay, is there any other way to do it, or is that the most effective?

craggy void
#

No, server travel is the way to go

harsh cargo
#

Okay, thank you

#

I tried standalone and instant crash haha

#

When going through the trigger for the next map I mean

craggy void
#

Try just typing the console command on the host to see if that works

#

Otherwise try a packaged build

distant wave
#

Updating a rep notify variable on tick than doing some stuff in the on rep function, will it affect performance or not?

kindred widget
#

@charred marsh@twin juniper For future reference, I used to use GetPlayerController for client stuff like widgets and local interaction. I fell on my face with that at the new work place. It won't always work correctly in Listenserver setups because there are rare conditions where a client's controller can be created first, which will make them 0 instead of the listenserver. and if you use that to get the listenserver's controller, you can end up with a client's. The safer way if you're not blueprint bound is to use GetGameInstance()->GetFirstLocalPlayerController().

real nimbus
#

Hi so I have a question, in my games I'm using only one run on server event for doing things, but when I downloaded someone others project, I saw that he was doing it twice in run on server and run on owning client event . My question is, which one is correct and when would I use which. Thx for reply.

tough gyro
#

so I implemented my replicated weapon firing logic based on Tom Looman's survival game repository code and I'm wondering if it's actually a good way to do it, mainly how hit effects are spawned on other clients.
For anyone who doesn't know, it changes an FVector RepNotified variable (that skips owner) that is used to spawn effects at some world location and the fvector variable is changed every time the owning client tells the server that it fired somewhere. Server then does a trace to verify it hit something and replicates the hit location to other clients via the repnotify.
Now, is this actually a good way to simulate weapon firing and hit effects on other clients? Wouldn't it make more sense to just replicate the firing state of a weapon (firing or not) and then do the traces on other clients and have them simulate the firing and hit effects locally instead of waiting for repnotifies from server?

#

for rapid firing weapons that is

#

I guess at most there would be some de-sync in the firing times between owning client and other clients

lament sinew
#

@kindred widget wait how is that possible? a player controller is created when you successfully log in to a server.
how can a client controller be created before the listen server controller?

kindred widget
#

Seamless travel.

cyan drift
#

Hello, i implemented voip talker to my game and it works, but I want to give the option to mute other specific player. It works only to the server, the host can mute other players, but on the clients it dont work. I am calling an event on the player controller from the widget when click the mute button. Anyone know how make it work?

twin juniper
#

could anyone share with me a resource to setup a simple listen server so other players can join my game?

thin stratus
#

OpenLevel with ?listen option is basically enough. If your ports are open and the other person knows your IP, then a simple open IPADDRESS in the console would work

warped berry
#

what's the best way to persist player choices in lobby before seamless travel to game map?

winged badger
#

put them in playerstate

#

copy properties over

#

and its best just because its by far the simplest

warped berry
#

what about SeamlessTravelTo(NewPlayerState) ?

zinc hound
#

I don't know if this is the right channel to ask this but how would I move my "dedicated server"(Just local host right now) to a actual vps such as DigitalOcean? I followed a tutorial on how to make a dedicated server but that only works for your own IP and not another one.

winged badger
#

if you have different PS class for lobby/game @warped berry

#

make a base with all the members holding the data that needs to be transferred between the levels

#

and override CopyProperties to copy it over

#

if its the same class, just overriding CopyProperties is sufficient

#

server will have all the info the lobby PS had and Copyied over before it attempts to spawn a pawn for the player

warped berry
#

sounds great, thank you @winged badger , will try it

#

but I've seen people in answers hub say that I cannot make those variables BlueprintReadWrite but idk why is that

winged badger
#

you don't technically need the common base for PSs, but its a much more elegant approach

#

what variables?

warped berry
#

the ones i want to persist on seamless travel

winged badger
#

it doesn't matter one bit

#

it doesn't even matter if its UPROPERTY if you're overriding the COpyProperties in c++

warped berry
#

ok, so those variables do not replicate by default, i have to make them replicate myself?

#

i mean since PS is replicated on its own

winged badger
#

if you need them replicated yes

warped berry
#

okay thanks again

leaden atlas
#

is there any performance penalty for doing like

#

calling 40 rpc functions

#

as opposed to calling one rpc function handling 40 things?

#

like are RPCs batched?

winged badger
#

they are not batched

#

but you can do it manually

#

aggregate the related data and RPC once instead of a dozen times

charred marsh
warped berry
#

I used CopyProperties in C++ PlayerState to copy a string value during seamless travel but only the host(listen server) is able to persist it when map changes, client's version still hold the default value, what am i missing ?

warped berry
#

anyone can give me heads up?

peak pollen
#

@dark edge @hollow saffron

I got it working on server and all clients.

Here is what I came up with. I am checking for input change so it should not be bad. Again I need these inputs to tell animation what direction to go in. Than I will get curves (movement speed, yaw rotation and so on) of current animation and than do actual movement based on those curves.

https://pastebin.com/UF69NgV8

shadow aurora
#

Alright so... I am just really struggling with this.

I have a controller which I need to unpossess its current pawn, do a setviewtargetwithblend over to another pawn, and then possess it.

Everything goes sort of alright, except that on the client (works fine on server) the newly possessed pawn rotates to match the controller/old pawn orientation from BEFORE the setviewtargetwithblend.

Does anyone know what the hell I'm doing wrong? Because this is really frustrating haha

peak pollen
torpid geode
#

Hey guys, I got a question.

I know that I have to be using a source build of Unreal in order to use the dedicated server method

But do I really have to give up the ability to use any blueprints?

If so, I almost only ever see tutorials for blueprints, is there a site that shows you the methods which appear in blueprint nodes, and how to access them in a C++ IDE?

For example, this node: https://docs.unrealengine.com/en-US/BlueprintAPI/Utilities/GetCommandLine/index.html

Get Command Line

rapid bronze
#

If you wanna know BP to C++ for the IDE then you can just search what you need with the word C++ and UE4 and it'll appear in a google search

#

Usually they are named similar or the same as the BP one indeed

#

But yeah, Dedi Server doesn't stop you from using BPs, not at all

torpid geode
#

You must have a C++ project that can support server-client multiplayer gameplay.

If you are using a Blueprintb project, you will need to convert it to a C++ project before you can proceed.

#

Then what does this mean?

rapid bronze
#

Dedicated Server needs C++ to be compiled in the first place :p

#

It doesn't come out of the box, so you just need to compile it yourself to use it shortly

torpid geode
#

Okay, I'm glad to hear that although I'm still confused about what that blurb from the unreal documentation means

#

I have a friend and he's never programmed before (and this is my first unreal project) so I was like "Man, is he really gonna have to deal with pointers? That'd suck."

rapid bronze
#

That's the definition of converting BP to C++ they are referring to in the docs

#

Yeah, pretty weird wording tbh

shadow aurora
torpid geode
#

I appreciate the help, but this is already starting to go over my head.

Good to know that when I start the project I can use Blueprints though

peak pollen
#

I to was using setviewtargetwithblend

shadow aurora
#

Anyone have any suggestions or ways they've tackled something like this in multiplayer? Like I said, works fine on the server and in single-player. Just on the client that it doesn't want to function.

rapid bronze
torpid geode
# rapid bronze You don't need to compile a dedicated server to test it in the first place, Edit...

Correct I just graduated college and I was working full-time while I was going to college so I was non-stop work work work.

Now I'm doing this project for fun with a friend to learn and to push myself to create something.

I've never created a multiplayer network game before and I want to create one which uses docker architecture to only spin up exactly as many servers as it needs.

I'm being a software professional enforcing my friend and I to follow a very loose Sprint schedule.

The Sprint for me was to get a dedicated server that we could connect to, even if we can't do anything, up and running.

#

If scrum becomes unfun, I will pick fun

For his sake more than mine lmao

rapid bronze
#

Grats for graduating!

My advice is to learn Replication first of all if you don't know it already, have it all work in the integrated Engine Dedicated Server option then look on how to Compile one and perhaps push it on a platform where you and your friend can connect together ^^

torpid geode
#

Is it possible to use the same logic in the game for assuming that I am the server (client listen server i think?) and then still build it to work with a dedicated server?

#

Or would that be a significant amount of tech debt?

rapid bronze
#

Listen is just you being the Server in the end

torpid geode
#

Cool

rapid bronze
#

Dedicated is just a server without physical presence

oak token
#

headless in other words

torpid geode
#

All animations should just play on client machines right?

#

That's what is assume.

#

One of the things that will be weird to me will be making two visual effects for everything

#

One that the player sees when they do it, and one that everyone else sees.

#

E.G. when Ashe throws her dynamite in Overwatch, her animation is only for her. And she can't see the one everybody else does. Only sees the dynamite when it spawns in the scene.

Same with muzzle flash.

rapid bronze
#

Animations are run on Client, it's up to you to decide which ones are Replicated

#

So you could see yourself doing an animations but everyone else sees you just standing still

torpid geode
#

Well, none.

The event of ThrowDynamite is broadcasted to all clients with the owner of that event, and the client's play the animation on that player.

But if it's the same player as casted throw dynamite they'll only see their first person animation.

#

That's how I imagine it at least.

rapid bronze
#

Usually in FPS, First Person has a separate model vs Third Person and UE4 enables you to only see First Person one on yourself

If First Person = Third Person then time to get creative!

torpid geode
#

That's true haha.

I've done some basic replication using the 2 player play mode in editor.

rapid bronze
#

It can be done in a multitude of ways, from AnimBPs to Anim Montages etc etc

#

It's just about getting there

frank pecan
#

I'm trying to change the walk speed of a pawn and I need to do it on the server so that it replicates to all clients but when ever I try to run any server custom event I get:

"No owning connection for actor BP_PlayerShip_2. Function SetSpeed_Server will not be processed."
but i don't want the ship to have an owner i want the server to own it so how do i change the speed?

twin juniper
#

I'm using steam sessions, a friend opened my setup and he could make and join sessions, but I can only make them

twin juniper
#

hi pls help i make characther selection it works but when i moved the characther they dont play that anination they just play idle and this characther is acopy from the main one but main one does work plss help

#

btw this is multiplayer

#

not single player

frank pecan
torpid geode
#

Autonomous proxy, authoritative?

#

Simulated proxy?

thin stratus
brittle tulip
#

I have very little knowledge of how networking works but maybe someone can help me. I have a UObject which I think ive extended to replicate like an AActor (used this resource https://jambax.co.uk/replicating-uobjects/). I keep getting freezes however which is a bit annoying to say the least. The blueprint only freezes when I'm running everything up to and including SetFormation. Both RankCount and FileCount is set to replicate. Can someone see where I'm going wrong (I know there is probably a lot).

void UMWUnitManager::SetFormation(int Ranks)
{
    RankCount = Ranks;
    FileCount = UnitEntities.Num() / Ranks;
}
chrome bay
#

Replicating UObjects is pretty tricky and error-prone, to be honest I'd only advise it as a last resort when a standalone actor or component won't do the job.

#

I say this as the person who wrote that ๐Ÿ˜„

#

Also potential divide by zero there

#

Also as that page says you have to replicate the UObject instance itself via an actor, they can't be replicated independently.

brittle tulip
#

๐Ÿ˜‚ Yes I did read that you had said it was better to use an AActor but for my use case it didn't seem necessary to use the AActor class. You are also correct in saying that there was the potential to divide by zero - this of course was exactly what it was doing...

brittle tulip
chrome bay
#

Just beware of premature optimization, the only reason I originally setup that code was because I needed to subclass inventory slots - but if you can reduce it down to just data, like an array of structs, it's probably better in the long run.

brittle tulip
#

Well maybe you can help me because this UObject is basically a controller for an array of AI characters which are all spawned on the server this object is created with them and then passed back to the character and set. Is it necessary for the replication or is there another way?

chrome bay
#

If it's just an array of controllers, why does it need to exist in a separate object? Can that not just be stored in some global state actor?

brittle tulip
#

It's not an array of controllers, it is an array of characters references. The UObject (UnitManager) is almost like a controller where the player set formations, tell the whole unit to move to a location, attack, defend etc.

#

The player of course could have many of these and thats why in the future I think im gonna add another UObject which stores these and can do macro commands to the units

chrome bay
#

If it were me I would just avoid that overhead altogether and just group them arbitrarily to be honest, but obvs without knowing the project I can't say

brittle tulip
# chrome bay If it were me I would just avoid that overhead altogether and just group them ar...

It's an RTS game, each player will have an army and the army has n number of units. All these units can be controlled individually by the player and have x amount of AI characters that can fight etc.

I'm only working on the unit control at the moment so I spawn 20 of these AI characters for example add them to this unit object which is the UnitManager (i.e. the interface for the player to control this unit by) because although I want the AI characters to interact some what individually in most cases I want them to act like a single entity. The AI characters can be different but every character in a unit will be the same for example, melee or ranged.

This is similar to Total War

Don't know whether that was helpful ๐Ÿ™‚

peak pollen
#

Why is my clients not having debugging? Not even "AddOnScreenDebugMessage" works.

peak pollen
brittle tulip
# peak pollen How complex are these individual units?

Unit or AI character?

AI character - unsure as of yet how complex they would become but they will have to fight and move at minimum.
Unit - well they will handle player commands like forming the characters into formations, telling each character to walk, run or attack etc.

peak pollen
#

Like for my inventory system. Its all Data orientated. If I wan't a certain inventory synced I just set it to sync with a bool. Than when I add or remove item I just send Inventory ID along with Item ID or Item Slot Index. Depends on the situation.

brittle tulip
#

I think I see what you are saying....

peak pollen
#

You could map controller with a TMap (Map in blueprints). Have ID as Key and Controller as Value. Than over the network send singles to which ID the unit is using.

#

Are you using any C++?

brittle tulip
#

yes

#

I have blueprints because I'm almost prototyping so its a combination

peak pollen
#

You would just need a way to identify the Units with a FName variable.

brittle tulip
#

So instead of setting the unit manager I just return like an ID for each unit instead of the whole unit

#

^^
The spawn unit spawns the characters then adds them into a new UnitManager which is returned as a reference and set for the player

peak pollen
#

Yes. Do you know of GameInstanceSubSystems?

brittle tulip
#

no I hardly know RPCs and replication ๐Ÿ˜‚

peak pollen
#

A subsystem is one instance per client and server. It can hold data and logic and can be accessed anywhere. You make it in C++. I can try and wiip you up somthing to get started.

#

I use these for each part of my game.

brittle tulip
#

why do I need something like this though?

peak pollen
#

I can even try and provide a simple networking example in it.

#

Because it is created and unloaded when game starts and ends for you. You don't need a reference to it like your doing. Its easier to get access to it in code and blueprints.

peak pollen
#

Think of it as a global singleton

chrome bay
#

A world subsystem is probably a better fit for this case

#

But Subsystems can't have network functionality natively, so you're still back to using an actor for some part of the networking.

#

Having an "AUnitManager" actor for each team doesn't seem outside the realms of sensibility

peak pollen
brittle tulip
#

yes but players will have multiple unit managers

chrome bay
#

I think either way having each unit be it's own object still seems like overkill for something that is just conceptual

#

In theory, each controllable unit will just have an integer value which determines what "group" it's in - and the group arrays can be locally maintained on each machine from that.

#

AKA take the simplest approach first, then add complexity as you need it

peak pollen
#

But they are grouped together when fighting.

#

Does anyone know how to enable debugging for clients?

chrome bay
#

Clients have their own worlds etc, they have to draw their own debug stuff locally

#

debug messages always draw to the primary viewport though

peak pollen
#

I am using Character->GetWorld()

brittle tulip
#

of course i'd be able to turn off some decision making if necessary at the time and let the manager handle it

peak pollen
brittle tulip
#

๐Ÿคฆ

peak pollen
#

That is why he groups them when fighting because CPU running on each character would be crazy. Plus each sending controller data over a network. I think that is crazy.

bitter oriole
#

Having bad performance with 200 characters is completely normal, it's a full-featured AAA player character class

#

Autonomous decision making is not the costly part here

winged badger
#

just CMC's check for overlaps takes a huge chunk of your CPU budget

bitter oriole
#

^

peak pollen
bitter oriole
#

Yes

#

That's a CMC problem, not an AI problem

peak pollen
#

Ok I see. Sorry I feel a bit dumb now lol.

bitter oriole
#

The real reason to centralize decision making for your AI is that

  • it's player driven so it only needs one networking entry
  • it's easier to have the server compute decisions and broadcast them through replication
peak pollen
#

But him rendering that many characters without a instancing would be a problem alone.

bitter oriole
#

No

#

Not really tbh

winged badger
#

for a RTS if using vanilla unreal networking you'd generally want to group 20 or so soldiers into a single unit actor

#

you don't want to be evaluating 500 actors for replication either, if you can get away with 25

peak pollen
#

Toltal war has over thousand, several thousand per fight.

winged badger
#

total war is on a custom engine designed to do just that

#

thats been in development for what 15, 20 years now?

peak pollen
winged badger
#

render is also not a problem

bitter oriole
#

^

winged badger
#

you can have niagara fake a million units really

bitter oriole
#

Check out the spider crawling away from lights in samples

#

That kind of stuff

winged badger
#

your 2 chokepoints are movement and evaluating actors for replication

kindred widget
#

And you're probably going to run into the first one of those first.

#

You can see for yourself by just spawning a ton of randomly moving AI and profiling it. Sweeping movement from the CMC is stupid.

winged badger
#

what you can do is have a Unit/Squad/Company Pawn

#

that has its own AIController handling what its 20 SkeletalMeshes are doing

#

1 Pawn = 20 Soldiers

#

and while it takes a bit of work to write that Pawn right, it should have acceptable performance

brittle tulip
#

does the pawn class not use CMC then?

kindred widget
#

CMC is designed for the character class. CharacterMovementComponent.

winged badger
#

then you can think of Total War not as using 1200 soldiers, but using 30 unit Pawns instead

#

and suddenly its not as intimidating

bitter oriole
peak pollen
#

But he said he want's them to be individual as well

winged badger
#

then the game won't work

#

or it will be a really small numbers RTS

peak pollen
#

That is why I told him about Maner Lords and why they that dev chose small numbers. Because each unit is individual and grouped.

brittle tulip
#

can you explain how I'm supposed to control the movements of the 30 unit pawns?

winged badger
#

bottom line - it doesn't matter if the soldiers are individual or not, if the player thinks they are

#

it does matter for performance

brittle tulip
#

if the player thinks they are this is what I'm trying to get. Problem with 30 unit pawns if I then have a first person player movign around and trying to fight these. then what.

bitter oriole
#

The point is, if you have 4 players with high level commands, it doesn't make sense to replicate anything but these high level commands

#

If you can actually control 30 pawns individually, maybe you just want to replicate "unit 4 of group B goes there"

#

The unit doesn't need to actually be an actor or independent object

#

It certainly doesn't need to replicate

winged badger
#

or use CMC

bitter oriole
#

The granularity of your unit depends on how good its individual movement has to be

#

If it has to performs sweep, climb above obstacles or that kind of stuff, well..........

#

Total War units are dumb

brittle tulip
#

So creating a unit controller as a pawn which then has many meshes inside is the way to go?

bitter oriole
#

It's definitely one performance-sensible way

#

As long as the units stay kind of together and make sense

winged badger
#

unless you want to go on a crazy half a decade long engine exploration like GlassBeaver

#

๐Ÿ˜„

bitter oriole
#

We don't speak of GlassBeaver

winged badger
#

and basically turn unreal into a half-custom engine

peak pollen
brittle tulip
#

honestly think my brain might explode if I try writing this

winged badger
#

because you are trying to account for all the steps you need at the same time

#

atm

#

you can't, and you'll run into plenty of dead ends

#

before you get it right

kindred widget
#

You feel like that now. Do some simpler stuff. Mess around with performance metrics. Believe me, stuff that felt overwhelming last month will seem easier.

winged badger
#

also, if its BP only, i'd recommend going for a side-scroller instead

brittle tulip
#

nah its cpp i just have some in BP

peak pollen
winged badger
#

instead of trying to do skeletal meshes, do spheres with arrow components pointing forward

peak pollen
#

You could use a pawn but that is how I would do it.

winged badger
#

or capsules

brittle tulip
peak pollen
#

You could even just render the capsule in code. No need for components.
DrawDebugCapsule(GetWorld(), Lcation, Height * 0.5f, Radius, Rotation, FColor::Green, false, -1, 0, 1.5f);

winged badger
#

prototyping

peak pollen
#

Even a arrow can be drawing with DrawDebug

brittle tulip
#

Nahh honestly definitely gonna be fine doing this just time to delete some code...

robust kraken
#

I'm trying to get seamless travel to work in a PIE session using the listen server configuration. I have 'use single process' disabled, but still get the 'Seamless travel unsupported in single process PIE' error. The Play as Client netmode works fine. Any ideas?

winged badger
#

seamless travel doesn't work in PIE

robust kraken
#

It does seem to work, just only in a very specific configuration (dedicated server + multiple processes). Given how much Epic favors this approach to travelling, it's odd to me that the PIE workflow is so compromised.

bitter oriole
#

PIE is a very special case, lots of stuff behaves weirdly there

#

Multiple processes is basically not really PIE

#

It's more like right-clicking the uproject + launch, except with auto join

robust kraken
#

Is there a way to use the editor session as a dedicated server for two clients in different processes? I'm trying to understand the iteration loop. For example, how would you debug server-side blueprint code?

winged badger
#

honestly, by having enough c++ to debug from there

robust kraken
#

Fair enough

winged badger
#

we also have our game levels in PIE set so we can fake around the fact players weren't in a lobby prior

#

so MP in PIE, even single instance behaves like a packaged game level

#

(at least for most stuff that matters)

robust kraken
#

For sure

warped berry
#

In seamless travel, would the server handle CopyProperties in all player states or each client would call his own?

chrome bay
#

Server does it

shadow aurora
warped berry
# chrome bay Server does it

Im trying to seamlessly travel from lobby to gameplay map but only the host's data make it to the gameplay level, the client is set to default value!

chrome bay
#

The properties need to be replicated of course. Seamless travel doesn't keep the same player state, a new actor is created so any client-only data will be lost.

#

If you need to preserve data client-side during a travel then you may need to keep it elsewhere.

#

Some folks use game instance for that

warped berry
#

so the player state being replicated to all clients by default does not guarantee that the sever would copy it for the clients?

chrome bay
#

If the data you want to preserve only exists on the client then it will be dropped, server won't have any clue about it

#

copying props between actors for seamless travel only occurs on the server essentially

warped berry
#

okay so then when i make them replicated, it should be changed on server first through server RPC ?

chrome bay
#

Basicaly if you want client-only data to persist through seamless travel, move it out of the playerstate would be the best way

#

Put it in some object which doesn't get destroyed with the world

peak pollen
#

This may seem like a weird question but with context I hope it makes sense.
Is a FVector2 var more bloat than if I were to make a custom struct with just 2 floats. I ask this is because when I used Unity they made a big deal when DOTS first came out that they made a new math library. In it was float2, float3, and float4. They said it gave better performance than using Vector2,Vector3,and Vector4. I am sending a FVector2 over network and I was wondering if I am better off making custom float2 struct.

chrome bay
#

No point wasting bandwidth on replicated properties if they don't need to be replicated ultimately ๐Ÿ™‚

#

@peak pollen will be exactly the same cost

peak pollen
warped berry
chrome bay
peak pollen
#

Thanks for the explanation. I found it annoying in the Unity 3-4 days where I could not use new .Net stuff and was confused why Unity would do such a thing.

warped berry
chrome bay
#

Yeah in that instance it would probably make sense yeah

warped berry
#

thank you for your time, I will try it

shadow aurora
#

Ok I swear I'm not an idiot... Does anyone know why casting this AI Controller is failing on the server but not the client? I have the AIControllerClass set to the proper class, but it just keeps failing.

spark owl
#

also it depends what class this is you're running it from

twin juniper
#

I'm using steam subsystem and in the editor I can create sessions when playing in the editor but I can't join them. A friend opened the project in the editor and he could create sessions and join sessions without issue when playing in the editor with the very same code/setup I made.

#

Any idea what's happening

warped berry
#

I use steam OSS as well and I never was able to test steam in the editor, it doesn't work as expected when it detects the editor

#

it shuts itself down

clever plinth
#

I'm trying to better understand the behavior of "Net Load on Client". I have a couple of actors where I disabled it. On one, the actor static mesh loads and displays as expected (on the client). On another, it just appears as a grey bounding box (in the correct position though). My understanding is that if the param is disabled (false), the object should not be loaded with the level but will still ultimately appear on the client if the object is configured to replicate. Is that wrong?

shadow aurora
bitter oriole
#

Don't think there is but for the most part : no sessions, no seamless travel (except in multiprocess maybe ?), some things are shared like debug prints are shared on every viewport in single process because it goes through GEngine, etc

shadow aurora
nocturne iron
#

Can i safely call a multicast implementation on the server?

bronze arch
#

every time i've seen "peoples cant run 500 or more CMC/AI/Players in a map with stable performance" What this actually mean then?
I just spawned 500 ai there.

bronze arch
#

even i able to get 500 fps if i do tick optimizations within 100~ ai in a MOBA map

#

Everybody talkin 'like it's a hardest thing

peak sentinel
#

So your 500 CMC ran run and skeletal meshes can render in a listen server model without any performance impact on average computers?

nova wasp
#

Now run them all with layered animations etc

bronze arch
peak sentinel
#

Also looks like you are using TPS/FPS camera, its easier to manage lods, even the movement tick frequency based on rendering data

#

Try a top-down angle

bronze arch
bronze arch
peak sentinel
#

thats means narrower field of view and more FPS.
I barely can get 60fps on RX570 with 50 characters (2k vertex, cheap material, very cheap c++ animbp)
LODs and render things not related about game thread
Idk the technical details, whenever any of my threads cost CPU power they all rise together, mainly CMC causes that and when rendering is too costly CMC also rises with render thread

#

Anyway not in intention to argue, good job if you could run it

#

My ryzen 2600 and rx570 cant handle 50+ CMC with 4 players + listen server

#

Since also my AI and rendering thread also consumes a lot of CPU

#

Especially hosting player goes crazy

peak sentinel
#

I have 20 CMC limit max and 50 FloatingPawnMovement limit for my AIs

bronze arch
dark edge
#

Is multiplayer world origin rebasing a thing?

#

This is for a coop spaceship roguelike in 2d. Either a square playfield or spherical one.

#

Right now I've got a large spherical playfield feeling pretty good without rebasing but if it's easy, rebasing might help.

harsh lintel
#

I've setup a listen server like this, but for some reason AddMovementInput looks like this:

twin juniper
uncut atlas
#

Hi, Is there a way to determine if the level your on is a listen server?

#

Never mind. I found GetWorld()->GetNetMode()

empty mica
#

Hello, can someone point me to a right direction? I would want to implement origin shifting with multiplayer. How would I do it? Like the basic idea

warped berry
#

I have lobby where players can choose a character, when a player chooses a character I want to lock it from other clients, so now I have a server RPC to check if the player can choose this character or not,,, THEN what would be better: sending back a multicast to lock that choice on other clients or just make that property replicated?

warped berry
# empty mica Hello, can someone point me to a right direction? I would want to implement orig...
twin juniper
dark edge
empty mica
dark edge
twin juniper
dark edge
#

Just key value into AddMovementInput or are you doing anything weird?

twin juniper
#
{
    AddMovementInput(FVector(1.0f, 0.0f, 0.0f), InputValue);
}
``` key input calls this
warped berry
#

@twin juniper @dark edge yea but at first I thought replicating could be congesting network since it just changes once when the player chooses it

dark edge
#

That same pattern applies all over the place. Replicate the fact that the door IS open, not the opening event. So later when someone comes into relevancy range or joins the game, they see the door open even though they weren't around when it was first opened.

warped berry
#

oh I missed on that, I'm still a noob xd,,, but yea that makes total sense to me, thank you

warped berry
dark edge
#

It's pretty rare that you need a multicast RPC

twin juniper
#

my listen server is spawning a pawn since it uses the same game mode pawn class as clients, is there a way to avoid spawning the pawn if it's the listen server?

dark edge
#

@twin juniper Uh, doesn't the listen server have a player playing at it?

#

What do you want the player on the listen server to be doing?

twin juniper
#

I didn't know the listen server could be a player too

dark edge
#

Listen server has a local player, dedicated server does not

#

Like old school Halo would have been done with listen servers, one player is the host.

harsh lintel
#

the listen server is not executing client RPCs code though

twin juniper
#

is there a way to identify the listen server? something like if (IsListenServer()) {...}

warped berry
twin juniper
#
``` this is true for all clients though
#

this if is inside the game mode pawn class

warped berry
#

if you just wanna know if this instance of the game is a listen server or not just check on the net mode
if(GetNetMode() == NM_ListenServer)

warped berry
twin juniper
#

but they can see each other so I'm pretty sure it's the same server, this is how the listen server is created and how the players enter the server

dark edge
#

@twin juniper every instance that clicks the start game button will launch a listen server, whatever instance clicks the join game button will join the listen server on localhost. If there are multiple listing service open, I don't know what will happen.

twin juniper
#

I'm only opening one listen server

dark edge
#

There is effectively no difference between a listing server with only the local player on it, and playing standalone.

dark edge
twin juniper
#

That this code: if (GetNetMode() == NM_ListenServer && GetLocalRole() == ROLE_Authority) is true for all clients, I need a way to identify which pawn/controller/player state/etc are the ones given to the listen server by the game mode

twilit flint
#

Cmd: Net PktLag = 5000
Command not recognized: Net PktLag = 5000

#

how can I now simulate lag ?

meager spade
#

net pktlag=300

#

dont use 5000 that is not realistic at all

twilit flint
#

yea, it was for test command

#

I've founded solution

#

NetEmulation.PktLag = 300

dark edge
dark edge
silk abyss
#

Moon I think is about 2.5 secs round trip, so 5 seconds is like twice the distance.

#

(remember you can fit all the other planets in solar system into the gap between earth and moon)

dark edge
#

@silk abyss that's why I said beyond the moon LOL should cover for pings from 2500 milliseconds to 1 billion years

tough phoenix
#

Hey so I just started unreal, like just just started (like a week ago) coming from unity, I'm trying to understand the multiplayer thing, I've been stuck for an hour on the replication of spawning an actor and I swear I'm going to bang my head on my table

#

I can spawn it from the server and it shows on the client, but if I spawn it on the client, it only shows on the client, even though I'm using an RPC on the server

thin stratus
#

I do have to point out that starting with multiplayer when you just started with ue4 is a bit crazy :P

#

The ServerRPC needs to run in a client owned Actor. Otherwise it's dropped.

#

Read the compendium that is pinned to this channel about multiplayer, replication and ownership

#

@tough phoenix

tough phoenix
tough phoenix
thin stratus
#

Idk, never really used unity

#

Show your code then. Might be something you do wrong

tough phoenix
#

you just type in "Network.Instantiate" and it goes to everyone

thin stratus
#

Yeah but unity is not ue4. You might not be able to utilize any of the knowledge from coding in unity when doing ue4

tough phoenix
#

yeah I noticed

thin stratus
#

What actor is that in

#

Or rather blueprint

tough phoenix
#

the gun of the client

#

i forgot to put transform in transform

thin stratus
#

Can you show me how you spawn the gun

tough phoenix
#

but it was like that before

#

I literally used devsquad's tutorial

thin stratus
#

Is that happening on the server?

tough phoenix
#

the gun spawn?

thin stratus
#

Yes

tough phoenix
#

i can see the gun through both client and server, so I guess (?)

thin stratus
#

But either way you need to specify the owner pin on the spawn actor node

#

It's hidden so you need to expand the bode at the bottom

tough phoenix
#

what do I put in that pin?

#

to say it's mine?

#

the mesh?

thin stratus
#

No

tough phoenix
#

this ?

thin stratus
#

Best would be the controller that controls the character.
But idk where you are calling the spawn code, so try self

tough phoenix
#

ok ill try using that wait a sec

thin stratus
#

That only works if you spawn the weapons after the character is possessed

#

If you spawn e.g. In BeginPlay of the character then the character won't be possessed yet and won't have a controller