#multiplayer

1 messages ยท Page 206 of 1

nova wasp
#

replicate the position of the static mesh? you don't seem to share anything about how it moved

glacial moat
nova wasp
#

sure, but do you set the actor to replicate movement?

#

if it's moved as a result of something that isn't just the actor moving you may need to replicate the transform in some way yourself

#

I don't know what "moves a block" means here

#

if it's like a board game you would probably want to send just the idea of the "board state" and not the raw position of the mesh if possible

#

but either way is fine

nova wasp
glacial moat
glacial moat
magic vessel
#

Got a stupid question

#

Where does the LocalPlayer live in the network? I know how the gamemode/state, player controller/state/pawn & UI are and how they interact but I can't find out where the ULocalPlayer lives

lost inlet
#

It doesn't

dark parcel
#

If I want to create a dedicated server but the number of lobby is on demand (created per user login)

I suppose one of the way is to have a virtual machine on the cloud that create and destroy instances of the session.

But I heard direct coms is not recommended and a middleware as a medium between player and the data base/ server is required. But how does that work?

lost inlet
#

A matchmaking service, which is likely exposed to the client as a web service

obtuse trellis
#

how should i duplicate object with DuplicateObject (particullary UStaticMeshComponent) and replicate it to client? because currently these line do spawn mesh on server but do not replicate this component to all clients

    UStaticMeshComponent* NewWall = DuplicateObject(InitialWallMesh, this, *FString("Wall Mesh").Append(FString::FromInt(Walls.Num())));
    NewWall->SetupAttachment(RootComponent);
    NewWall->SetWorldLocation(SpawnLocation);
    NewWall->SetIsReplicated(true);
    NewWall->SetStaticMesh(InitialWallMesh->GetStaticMesh());
    NewWall->SetWorldRotation(SpawnRotation);

    NewWall->RegisterComponent();
    Walls.Add(NewWall);
    AddInstanceComponent(NewWall);
#

but if i just create new component like so it works fine:

UStaticMeshComponent* NewWall = NewObject<UStaticMeshComponent>(this, UStaticMeshComponent::StaticClass(), *FString("Wall Mesh").Append(FString::FromInt(Walls.Num())));
    NewWall->SetupAttachment(RootComponent);
    NewWall->SetWorldLocation(SpawnLocation);
    NewWall->SetStaticMesh(InitialWallMesh->GetStaticMesh());
    NewWall->SetWorldRotation(SpawnRotation);
    NewWall->RegisterComponent();
    NewWall->SetIsReplicated(true);
    
    Walls.Add(NewWall);
    AddInstanceComponent(NewWall);
#

but i want a duplicate of it actually. to avoid copying meshes and collision settings, as well as materials

nova wasp
#

you will need to mark it as a replicated subobject, no?

#

and maybe SetNetAddressable

magic vessel
lost inlet
#

Yes, it's local only

#

thus the "local" part in local player

magic vessel
#

Great, that fixes a very annoying problem I've been having with a game instance subsystem

#

I'll convert it to a local player one, cheers ๐Ÿ™‚

obtuse trellis
prisma osprey
#

I'm working on a simple idea, like a walking simulator with some interactions, driving or take a bus, something like that. I'm thinking on make it multiplayer to make it more appealing, when users can share some stats/items, take a bus ride with other users (I guess it's hard to replicate that one..) I'm still unsure to go that route, or just making a "simple" single player game.

I haven't tried GAS yet, I guess it gets easier with a tutorial, you're right, I haven't considered that C++ can help to understand blueprints better, I'm always worried that spending a lot of time learning new things can lead to have a lot of unfinished projects...
Thanks for helping, being alone with all those thoughts isn't easy, what about your game, are you being able to successfully replicate things like sailing and other stuff?

nova wasp
twin vessel
#

Is there any code example of cmc implementation of actors being able to push the character / does someone have any suggestion on how to implement it?

fossil spoke
#

You can impart forces on the CMC

#

You can "launch" a CMC

#

There are a few options

nova wasp
#

A client moving another client's cmc predictively?

twin vessel
unique fox
thin stratus
thin stratus
#

Eh, not sure. One usually doesn't use Physics with a Character/CMC.

#

Or if possible generally in Multiplayer, unless fully client-authoritative fwiw.

thin stratus
#

CharacterMovementComponent

tardy fossil
#

i'm curious.. where exactly is the client's control rotation replicated to the server?

thin stratus
#

via uint8 ClientRoll and uint32 View params.

#
uint32 ClientYawPitchINT = 0;
uint8 ClientRollBYTE = 0;
NewMove->GetPackedAngles(ClientYawPitchINT, ClientRollBYTE);
#
void FSavedMove_Character::GetPackedAngles(uint32& YawAndPitchPack, uint8& RollPack) const
{
    // Compress rotation down to 5 bytes
    YawAndPitchPack = UCharacterMovementComponent::PackYawAndPitchTo32(SavedControlRotation.Yaw, SavedControlRotation.Pitch);
    RollPack = FRotator::CompressAxisToByte(SavedControlRotation.Roll);
}
tardy fossil
#

ohhhh it's in the CMC no wonder I was missing it

thin stratus
#

Yeah, the world outside ACharacter and UCharacterMovementComponent lacks a lot of Multiplayer stuff :D

latent heart
#

Mover and NPP to the rescue. One day. Maybe.

obtuse trellis
# nova wasp and maybe SetNetAddressable

I did replicating using subobject list, still doesn't work for duplicate object, only for NewObject

    UStaticMeshComponent* NewWall = DuplicateObject(InitialWallMesh, this, *FString("Wall Mesh").Append(FString::FromInt(Walls.Num())));
    //UStaticMeshComponent* NewWall = NewObject<UStaticMeshComponent>(this, UStaticMeshComponent::StaticClass(), *FString("Wall Mesh").Append(FString::FromInt(Walls.Num())));
    NewWall->SetupAttachment(RootComponent);
    NewWall->SetWorldLocation(SpawnLocation);
    NewWall->SetStaticMesh(InitialWallMesh->GetStaticMesh());
    NewWall->SetWorldRotation(SpawnRotation);
    NewWall->SetNetAddressable();
    NewWall->SetIsReplicated(true);
    NewWall->RegisterComponent();

    Walls.Add(NewWall);
    AddInstanceComponent(NewWall);

    // Add new wall as replicating subobject
    AddReplicatedSubObject(NewWall, COND_None);
#

bReplicateUsingRegisteredSubObjectList is set to true

#

what am i doing wrong?

karmic trellis
#

Hello, is this hierarchy works for replicating? All replicating systems up but doesnt replicating from client to listen server. ๐Ÿค” what is the problem here

cobalt notch
# prisma osprey I'm working on a simple idea, like a walking simulator with some interactions, d...

That sounds like a simple noob idea but it doesn't sound like a simple idea, because when you do a bus ride and sharing items you're describing an MMO or something like GTA in multiplayer, there isn't any way to make this simple. You're fooling yourself then or instead of the bus ride you need to take a long journey of learning to achieve this. It's easy but when you have a big world there's a lot of things to consider. It takes a couple of years to even know if you're doing it right. C++ is worth it if you're deciding to pursue this on the coding side, if you want to be an all rounder I do blender too but haven't had any time to learn blender because of doing hardcore C++ coding. You can't do everything so you have to pick your battles and which skills to upgrade, think of it like a skill tree, do yo uclick unreal or blender and what parts do you upgrade to achieve your game. This would be easier to do if your idea was sane instead of a mini multiplayer GTA thing 'cos you still need every skill that a full GTA game would need to do this on a small level even and the same costs and all those other learnings. Like you can just figure out how to get your idea done if your skills aren't dependent on the idea but the idea is more according to your skills. If you're a good coder and this is your skill then sure, that's what you do which means winging the other stuff. Basically whatever you can showcase the most, if you're good at 2d Art then a simple slideshow story platform without any coding is better off than me.

cobalt notch
# prisma osprey I'm working on a simple idea, like a walking simulator with some interactions, d...

Also another misconception you mentioned is making it more appealing using multiplayer.. but then you won't have as much gameplay in the game and are riding off the user interactions as multiplayer games are interesting without having to do much, but that's cheating and it takes a certain quantity of players to achieve this.. so most Multiplayer games die before they take off.. So that's a huge misconception, you're basically saying you want to do an elaborate sort of city roaming friends sharing GTA6 game but on a tiny noobish level and to make this interesting you'll make it multiplayer.. You need to rethink this and see what makes games interesting to begin with. A single player game even if only someone's Mom plays it atleast someone did and it's playable forever but for Multiplayer it's obsolete as soon as you decide paying for the server wasn't worth it when everybody thinks the game is dead before it even launches. Considering this, I'm actually in the opposite view like making my Multiplayer game single player for the heck of it just to avoid this because Multiplayer games need numbers to survive.

cobalt notch
# prisma osprey I'm working on a simple idea, like a walking simulator with some interactions, d...

You're right that learning things can lead to unfinished projects, actually think of this, the peopel making courses do this full time, so like if you're doing courses from multiple people those people are churning them out and Epic is churning out new features daily too and tutorials associated with this. This is called Tutorial Hell. I have almost 100 courses in my Udemy and I hardly get time to do any. I feel like I watch more videos than coding. And its kind of annoying I want to do something quick and end up having to watch a 3 hour stream because that's the only video about that thing but you get used to it like taking minutes to compile to see every change. This is a really long ass process compared to normal coding which is instant, in this you write one line and then boot up the whole engine.. blueprints is more instant and much faster.. C++ is for bigger projects or more technical things or preference if you know it. So the first virtue is patience. My trick is I only do one project so I only have 1 unfinished project but if you want to do a game every 6 months I told you to stick to BP and learn something and see what you can do after this. It's not really logical to plan out your game before learning things because well then you have to learn everything, which means committing several years to one project. The best advice I can give you is look up some of your favorite game developers from seasoned companies on Youtube like Sid Meier etc. and see what makes them and their games tick.

grave notch
#

How do i wait for all characters to be loaded when game starts? I have all controllers, but characters still havent been loaded

keen adder
#

Heya guys, quick Q:
When starting playmode using the networked listen server, is this an accurate representation of playing online? (Like what will be replicated and what won't). Atm everything seems to replicate perfectly even though I've done nothing.

#

Also is there a way to simulate lag?

cobalt notch
# prisma osprey I'm working on a simple idea, like a walking simulator with some interactions, d...

Okay so I thought about this and if you want to do more than 1 project do not do multiplayer then. Just rule this out as an option for yourself. Otherwise you can't do more than 1 game probably because first of all most developers and companies do one game and a few do more than one game. Even famous companies that are 30 years old have not that many titles. Say a AAA company has 6 titles in 30 years, that's 5 years per title. Then like Epic have Fortnite but they didn't bother to do a game every 3 months or something like this. If your multiplayer game succeeds then you have a lot of work maintaining this and keeping it alive with new skins and battlepasses those goodies or it will become boring and die so then you're stuck even if you win. So depends on what you want to do.. but if it's more than one game then single player maybe better, 'cos you can start on the next game after releasing instead of getting stuck on one game.

cobalt notch
grave notch
cobalt notch
# keen adder Heya guys, quick Q: When starting playmode using the networked listen server, is...

It's not innaccurate as the guy hosting the game but if you do play as client that's more like someone playing your game on a dedicated server or connected to the host of the listen server, in listen server one player is the server and this one also has to be a client so the listen server mode shows you both client and server as its doing both for the guy who hosts the listen server match.

#

For simulating the lag its in the play settings in the editor settings I think or somewhere there you can set maximum and minimum. Look around you'll find it eventually.

cobalt notch
cobalt notch
grave notch
cobalt notch
#

Also by the time you're done you'll be waiting much longer thant his so it's not really practical 'cos what if you need to do loading and other things.

cobalt notch
# grave notch well i want to start the game on the server basically, apply some logic, send ev...

I think you need to do things where they're meant to be, otherwise you have to sort of do a loading system and wait till everything has loaded or fire events as things start up like a pawn starts and it's beginplay does something, even if it htis is a central sort of system you want to do things the pawn can tell this sytem taht its spawned so that system then adds it to the queue or whatever 'cos it will need to know all the pawns then too so you're doing that anwyays then and will need some queue or getallactors etc. so make that a queue instead btu that's not really very clean is it.

stable grotto
#

is it possible to disable collisions for one client only server side?
for example to enter a barrier only a specific client can enter

obtuse trellis
#
Epic Developer Community Forums

I have a function in my actor that dynamically creates new static mesh component (a Wall Mesh) next to my InitialWallMesh. Function i use is this: void ABuildableWall::AppendWall(int32 WallIndex, ERelativeDirection RelativeDirection) { // Make sure we are on server if(!HasAuthority()) { UE_LOG(LogSecurity, Warning, TEXT("Can't append wall ...

thin stratus
#

@grave notch If you only need to know on the Server, then shouldn't basically already have all the info for that cause the Server spawns them?

#

Or do you want to wait till the Clients are done too?

grave notch
twin juniper
#

Hi guys, I have a question. Using an Unreal dedicated server (using OpenLevel and passing the IP where the server is hosted), how many people would this server support? Assuming that it is super optimized and that it is a game that does not require much performance. Also, to host more than 1000 people, is it necessary to use OWL?

thin stratus
#

Possibly less.

twin juniper
#

Is that because your architecture is monolithic? If you used distributed architecture, could you increase capacity? I was looking at AWS's game services.

sinful tree
# twin juniper Hi guys, I have a question. Using an Unreal dedicated server (using OpenLevel an...

The theoretical maximum amount of clients a single server could host is 65535 but you'd never be able to reach this if there is any other network connections that server would need to make (which it certainly would). The complexity of the game and what kinds of optimizations you make for your game, as well as server hardware and network bandwidth availability can all contribute to how many players a server can support while still maintaining your intentioned gameplay.

twin juniper
# sinful tree The theoretical maximum amount of clients a single server could host is 65535 bu...

ok great, thanks a lot. so it basically depends on the server hardware and code optimization? i was reading and in a monolithic way it is impossible to reach a high number of players on the server thinking of an mmorpg game. i saw the amazon game lift services to use a distributed architecture so that several servers are in charge of handling the requests and everything that an authoritative server entails. am i right?

sinful tree
# twin juniper ok great, thanks a lot. so it basically depends on the server hardware and code ...

That's basically how it would need to work if your intention is to have lots of players all "connect to the same server". Most server systems have a single entry point and that entry point then directs the clients to the appropriate server to connect to and disconnects from the original. Unreal's built in networking system isn't really set up for MMO-style networking, and so, realistically, you could probably only reach about 100 players - most quote this number as it was what Epic was able to achieve with Fortnite.

If you're trying to make an MMO with Unreal here's two example ways to do it :

  1. Use Unreal's networking system but utilize instanced "zones" which you allow a certain number of players connect to that represent areas in your game. This would mean having loading screens between different zones and multiple copies of that area of the world running as a client would have to "Open Level" into a new server for each zone. You would also need some other server system that manages what zones are running, can spool up and shut down servers as needed based on number of players in a zone so that there's always available room for a player to move into the desired zone, but could end up in a zone that is devoid of players too. You also need additional servers for game-wide communication, like chat

  2. Not use Unreal's networking at all and use some other server system that you'd connect to, probably through sockets, that can manage all the communication that is required from server to clients and just have the client represent the world based on the data received from the server. You could allow a player to travel seamlessly across a vast universe in this scenario as they don't need to "Open Level" to a new server at any point in time, which means no loading screens. The bad part here is that you also can't use any of Unreal's built-in multiplayer features or any third party multiplayer plugins that rely on Unreal's networking since you wouldn't be using it.

tropic beacon
#

So I have an animation which is CanoePaddle, this animation is called on the server, then mutlicasts the animation. However, within the animation there is an on paddle anim notifiers that gives thrust. The idea being that I could apply a bit of thrust throughout the paddle, vs one big thrust upon the start of the animation, this gave me much smoother paddling and control of the canoe.

The issue is that when the host paddles the paddle only does its command once, but when the joining player paddles the paddling happens on the server and on the client thus giving me 2x the thrust I want. Now I know this is happening because of the multicast, but I am wondering how I can separate out the thrust over the animation from the multicast. I would need the thrust to be cancelled if the animation is cancelled or overwritten by a new one.

I took the multicasted animation out of the thrust server call and that solves the duplication issue, but now I have one single thrust on command and the animation plays out until overwritten which is intended.

Any ideas how I can sync up the animation to multiple thrusts without duplication? I also want it cancelled if another animation is started.

prisma osprey
# cobalt notch https://youtu.be/bY7aRJE-oOY

Hey @cobalt notch thanks for the insight, I guess I'll go without multiplayer, I'm gonna focus more on the gameplay + BP only, what you said make sense. I'm creating a new project after (almost) every new idea, and I just leave them parked on the hard drive, just for fun ๐Ÿ™‚ thanks also for the video looks interesting, I'm gonna watch it!

somber turtle
#

Using Seamless travel ?

#

If so then I got the same problem and submitted a ticket on UDN about it. It seems to be related to their GameplayDebugger having a (now) invalid ReplicatorActor and derefencing it before validating it (well technically they are validating it but after using it ๐Ÿคฆโ€โ™‚๏ธ )

#

Try setting bUseGameplayDebugger and bUseGameplayDebuggerCore to false in your Target.cs and see if it works (assuming you are not using precompiled binaries and have your own engine version)

versed hamlet
#

Hey all! Nooby here, I have an event which is running on server, and wanted another event inside it to only be fired in clients, as it is updating the UI for them. I tried to create a custom event to run that on client but it crashed my engine D:
Then, tried to just swap that event to a client-only event in the WBP_UI, but still no results apart from saving the crash haha, how should I handle that? Pic 2 is the event in WBP_UI

#

I also maybe used the wrong word for the comment on DrainDashBars event, but basically that's where the event should go to the client

somber turtle
#

Ideally you shouldn't invoke UI code from gameplay directly like that and instead have the UI bind to events and respond accordingly, but that's another discussion altogether

versed hamlet
#

I see! I'm not too sure on how to bind those as I'm creating them dynamically based on character's stats with a ForEachLoop, is there a way to do that? I'm running events because I'm not aware of other methods

somber turtle
#

MVVM is one way to solve that, but it can be a bit cumbersome. For my part, I didn't wanna go through that so I injected the context (a.k.a the possessed pawn of the local player controller) to the HUD widget and and of its children recursively when the widget is created inside my HUD BP.

This allows my to easily bind to events on my character (e.g. HP changed, anim state changed) inside widgets easily.

versed hamlet
#

alright, so the suggestion would be to just avoid bindings but rather use event dispatchers?

#

and what is MVVM?

somber turtle
#

You want your UI to bind to events from gameplay, but never really want the gameplay to grab a piece of UI and call functions on it directly (from let's say your character BP or anything similar)

versed hamlet
glacial moat
short arrow
#

15 years later

cobalt notch
# prisma osprey Hey <@469382266137739273> thanks for the insight, I guess I'll go without multip...

Yeah if you get a lot of ideas it's probably better to avoid Multiplayer and stick to single player, then you can do 3 to 6 month projects for publishing each idea and move on within a month if you want to abandon something. Also this gives you a chance to practice other skills. My plan is to make a framework this year and then I'll probably just focus on blender again after this. I started with the naive open world assumption most noobs do and stuck to it so if I'm ever done I'll only do this one game and so I do not have much of an idea either, just pirates in ships 'cos you can't really do that much innovation in multiplayer but every genre is open to single player. In hindsight I would just do 6 month games in bp and blender but I've gone too far this time. Also the annual Megajam and gamejams are good for forcing yourself to finish because otherwise it's hard to find the confidence until you force yourself to complete a fullish game. Jams usually have to be in bp 'cos of time constraints and it gives you the confidence. Before Megajam I didn't think I could finish a full game but after that I thought it was fairly easy to do.

glacial moat
#

How do I do client travel and server travel with bluprints?

modest crater
turbid mirage
leaden bone
#

Are FGameplayAbilityTargetData more efficient than FGameplayEventData for the bandwidth? I see that TargetData has a NetSerialize et GameplayEvent don't, so I assume that event payload are heavier to send via RPC?

#

Basically my combat is in WoW style: I target an actor then execute my ability. So at the time of activation I already know the target, and I'm wondering if it's best to activate the ability with an event payload or to send the target data to server from within the ability (in the latter case I would batch the ability activation RPC with send target data)

nova wasp
#

FGameplayAbilityTargetData is basically an interface in practice

#

from what I can tell

#

it all depends on which targeting structs you are passing around

leaden bone
leaden bone
nova wasp
#

-NetTrace=1 -tracehost=localhost -trace=net etc

#

at first glance FGameplayAbilityTargetData looks like you could make a child of it that is just the data you want and get away with less bits but I have no idea what the rpcs look like

leaden bone
#

Never used insight yet, but gotta start someday !

nova wasp
#

I find networking insights to be a bit fickle

#

it does work but in editor it might be a crapshoot

#

could be me missing something obvious, and frankly testing with true game processes is probably a more fair test of networking as they won't all be in one process (by default)

knotty bane
#

Can someone help me with this problem, i have a ingame button you press in the lobby to get teleported to the first level, if you interact it returns true so it seems to be working but nothing is happening? am i missing something

#

also made a variable in the custom event wich is now not connected but same result if someone is wondering why its not attached

upbeat basin
#

Is transition level guaranteed to be loaded with seamless travel? I have a route like seamless travel from menu to game map and hard travel from game map back to main menu. Could I imply that if transition level is loaded (FWorldDelegates::OnPostWorldInitialization), player is changing level to game map? Or should I create my own logic to keep track of it?

sharp hamlet
#

Any tutorial or documentation on replication of landscape displacement? (No nanites)

wary ermine
#

Hi @thin stratus , may i ask for some more help from you?

edit: fixed it thanks to your comments from last week! thank you!!!!!!!!!

burnt coral
#

I have set up Head Rotation inside of the Animation BP for Manny and I have no idea how you are suppose to replicate it.

dark parcel
#

For your head rotation, you can replicate the rotation

burnt coral
#

So I would replicate the Rotation variable then and I do this in the anim bp?

dark parcel
#

you can have the rotation variable in the owner

#

make it replicated

burnt coral
burnt coral
dark parcel
#

owner being who ever owns the anim blueprint

#

@burnt coral sometime you don't need to replicate the variable though, so it really depend on what you are doing

#

for example the NPC will just look at the closest player for my case

#

so I will not be replicating anything at all, I just let every machine run it's own code for the NPC to look at the closest player

#

__

If the head rotation is driven by player input or view however, then you do need to replicate it because you need to tell the server the rotation of the head, which the server then replicate to all other machines

normal valley
#

from networking perspective, what is the difference between running client in editor, connecting to remote server versus running client in packaged build

burnt coral
burnt coral
barren ironBOT
#
QuinnBot#0752

Version: 2.1.7
Last Login: <t:1721354786> โ€ข <t:1721354786:R>
Heartbeat: 74ms
Memory Usage: 69.71 MB
โ€”
Source Code โ€ข Report a Bug โ€ข Contribute

scenic cradle
#

Hello, anyone know how to set a custom name to the session?

normal valley
#
Epic Developer Community Forums

Hello everyone. Iโ€™m getting a strange (intermittent) error when connecting to my multiplayer game. On some occasions, as the player is traveling using seamless travel, I get stuck in the transition level, and am not able to possess my character. Here is what I noticed in the server logs. When the following statements in the logs are called in ...

#

someone here mentions "It seems that the issue was related to joining too early on the client side. Needed to wait until server was ready (especially since I had a large map). "

What does that look like in practice?

versed hamlet
#

hey guys, I'm trying to fire the bottom event in a widget, but keep getting a non valid result as the otuput get of the array.

I'm handling creation of widget in clients directly, but the event commented in azure is part of an event that runs on server. How would you suggest me to handle that? I thought about putting it there because it's supposed to happen in that precise moment of the action, but not sure on why I keep getting null references or how to make that event run on client. I was susggested to change the original one into a client event but still it didn't change things... lmk wha you think :D

real ridge
#

guys when I am copying functions like this to another blueprint how to get rid of this error? i dont want manually always create same functions lol I just wanted copy them

hoary spear
#

If you're doing that a lot , shared parent or component might make more sense for it

twin blade
#

Hi. Im trying to build a login system but i'm having some problems interfacing with the dedicated server.
Here is what i have for now:

  • login page with an api call, it gets an answer with a token if its ok
  • i try to pass that token when i open the connection to the server and try to check it in prelogin.
    Here is where my problems start. Prelogin finishes before my api has a chance to verify the token, if i deny the connection i dont really understand how to have it retry (hoping the check is done). I tried allowing it and then disconnecting after if its wrong but i dont like it because the player will spawn for a fraction of a second.
    Any advice is welcome. Thanks
cold cipher
#

anyways to destroy an actor by sending a message from the server side?
I tested with it, in listen server it did destroy
but not at client side

thin stratus
#

Replicated Actors, destroyed by the Server, will destroy on Clients.

rustic sable
#

If I have and array of values marked replicated, even if someone changes them on the client getting the value will still be whatever is in on the server right?

#

nope I can change them no the client.

#

How would you make an array that can't be changed locally? Do you have to do a Server call to set it locally every time?

vivid seal
#

Hey guys, am I correct in thinking that when PreReplication is called on an actor it doesn't necessarily mean that the actor will replicate this frame? It looks like PreReplication is just called on all actors being considered for replication, but that list is then sorted and not all of the actors in it are necessarily replicated right away.

#

And if that's true, is there another function I can use for "this actor is definitely about to replicate RIGHT NOW?"

sinful tree
# rustic sable How would you make an array that can't be changed locally? Do you have to do a S...

You cannot. You do not have control of client computer hardware. Any point that you "set" a value, someone could manipulate their computer's RAM so that value cannot be changed or changed to whatever they want. The best you can do is replicate data to them, and if they are requesting the server to do something, you should scrutinize the request and any of the data that they send back to the server.

#

The server is the "true" state of the game. Just because a client changes the value on their end doesn't mean everyone else sees that value.

rustic sable
sinful tree
rustic sable
#

ah ok, so instead of passing anything just check the HasAuthority version against the non authority one in an rpc call?

#

basically they are just strings in arrays and when the player locks in these choices the server sends them to playfab

#

oh wait, yeah it's even simpler hehe. Just use the sever version regardless so even if the client one is fudged with it wont really impact anything

sinful tree
#

Exactly ๐Ÿ™‚

#

Only allow the client to tell the server the minimal amount of data required. The server should typically already know the state of anything gameplay important itself and would only replicate that information to the client so they can display it on their end.

lament flax
#

using FastArrays, can you get the old value before a change ?

lament flax
#

yeah i was pretty sure that was the answer

severe cedar
#

Hello! I'm trying to implement a dash using root motion sources, but I'm not sure I'm doing it correctly. I'm not using GAS so I'm basically manually creating a FRootMotionSource_ConstantForce and then applying it manually via ApplyRootMotionSource.

This generally works, except I can see a tiny bit of rubberbanding on remote players at the very end of the dash. It seems like the ending positions between client/server are slightly off, and so it gets corrected at the very end of the dash, which looks like the player is being snapped backwards a few units.

I wanted to double check if I am applying this RMS correctly. Right now we basically have a replicated Actor that calls Dash() on both server and client. The client is called first predictively, so it'll call ApplyRootMotionSource() a little before server. There's no RPC from client to server; the function is just called on both instances in parallel with the same parameters.

Is this the correct way to be doing this?

vivid seal
#

how is the function being called on the server? like how are you triggering the dash on the server?

#

Reason I ask is that in my limited experience with root motion sources, the best way I found to sync them was to make sure the server was triggering the root motion based on something in the networking data, so either a compressed flag or some other variable passed via move data

severe cedar
#

We have a replicated Ability class which has an Activate function. Dash is being called from there. Activate is called via client input. On the client, it will execute Activate immediately (for prediction) and then RPC to the server and call Activate on the server. Once the server receives the RPC and calls its Activate, then it will also call Dash.

#

Oh interesting, but if the server itself is triggering it, will you be able to have it immediately execute on the client for responsiveness reasons?

vivid seal
#

i usually client predict ability activation, and then the server activation is just validating/cancelling the root motion if needed. I wrote a whole bunch of nonsense code to handle a potential race condition, since the CMC data isn't reliable so the ordering isn't guaranteed, but I'm not really sure it was necessary.

daring gorge
#

hi this iss going to sound dumb but im using an onrep function and when i try to read a variables value on rep using 3 clients on editor only client 2 responds back?

crisp shard
#

something like a projectile explosion / hit VFX would be multicast and not repnotify right ?

severe cedar
tropic beacon
crisp shard
dark parcel
cold cipher
#

something weird is happening
shooting targets with 100 hp
the server PIE can make the actors destroy (coded after hp becomes 0)
while the client could not destroy them
and at both sides the hp are calculated seperately?

dark parcel
#

If you don't inform of the server of the change using server rpc, then the change will only happend to that machine.

#

@cold cipher destroy the actor on server, if it's replicated actor. The client copy will be destroyed too

cold cipher
#

yes it did destroy on client this time

dark parcel
#

If it doesn't then check how you are spawning the actor.

For replicated actor, only have the server spawn and destroy (in general)

dark parcel
#

There is pros and cons in all method

#

It's about what you are willing to sacrifice when it comes to mp, I guess

Personally for fire and forget stuff like sfx, you can just use multicast when it really doesn't matter if some player end up not seeing the sfx.

For anything that needs to be in sync, eg special effects on the Wolf in sheep clothing, you don't want to use multicast.

If you are using GAS, just use gameplay effect and let it do its thing.

cold cipher
vapid gazelle
#

Is it somewhat of an antipattern if player spawning in a multiplayer game is handled by the Game State? I figured this would be something managed by the Game Mode, but then there are certain facts that the game state is tracking, such as whether the game or the round is over, which only live in the game state.

So in the codebase I'm looking at, the spawning is ultimately deferred to the game state, on the server. My impression however was that game state was perhaps more about bookkeeping and less about altering the state of the game itself, more of a read-only data source for something else to tap into.

Fair to say that's not the correct interpretation and it's totally fine to let the game state handle that?

From the official docs:

The Game State is responsible for enabling the clients to monitor the state of the game. Conceptually, the Game State should manage information that is meant to be known to all connected clients and is specific to the Game Mode but is not specific to any individual player. It can keep track of game-wide properties such as the list of connected players, team score in Capture The Flag, missions that have been completed in an open world game, and so on.

Makes me think that maybe the Game Mode should be checking with Game State about the state of the game, but then itself take care of modifying the game?

somber tundra
#

Hey! If it's not too much trouble, I'm trying to create a simple, replicated countdown timer, but I can't get the replicated variable to work.

sinful tree
somber tundra
#

Replicates is set to on in the class settings

sinful tree
#

Are you setting a timer on begin play or something?

somber tundra
#

Yes!

#

Timer calls a custom function which just decrements the int every second

#

This reflects on the server but not the client

sinful tree
#

You have the Begin Play gated with Has Authority?

#

or Is Server/

somber tundra
sinful tree
#

ok, how are you checking the value of the int on the client?

somber tundra
sinful tree
#

On what event?

somber tundra
#

1 key pressed

sinful tree
#

Can you show some screenshots of your events?

somber tundra
#

Yeah, give me a bit. Ty

#

So here's a basic screenie of the listen server vs client

#

Pressing 1 displays 10

#

Quick picture of my code

sinful tree
#

You don't want the "Update Timer" event as an RPC. I'd also avoid using Set Timer By Function Name - just use Set Timer By Event and you can connect the event you want to use to the orange delegate pin it provides.

somber tundra
#

I'll try fixing it and lyk, I appreciate the help

sinful tree
#

Otherwise, if the Has Authority is connected to begin play the timer you have there should be working correctly.

somber tundra
#

Does it matter that I'm running it on the listen server/client setting rather than standalone?

fluid prawn
#

Quick question I managed to create my own encoding and decoding for simple float to serialize for the network. I was wondering if the engine has quantization for float packing into a smaller type?

#

The only thing i've found is quantization of FVectors, I think they just send raw floats over the wire asfaik

hollow eagle
#

there's probably some utility function hiding somewhere. Iris has all the functions in BitPacking.h, I don't know that the same exists for FArchive-based netserializers.

fluid prawn
#

Out of curiosity, for float values over the network what is the best practice for sending floats over the network? I assume for raw input values you can just send the entire thing and for some other calculations maybe 2-3 decimal places?

grand mica
#

Hello! Need some help with replication

    UPROPERTY(ReplicatedUsing = OnRep_Position)
    FVector ReplicatedLocation;

    UPROPERTY(ReplicatedUsing = OnRep_Rotation)
    FRotator ReplicatedRotation;

    UFUNCTION()
    void OnRep_Position();

    UFUNCTION()
    void OnRep_Rotation();```

these are the replicated variables and their OnRep methods. I change these variables here 

```c
void APawnAgent::MoveAgent(float deltaTime)
{
    m_newVelocity = FVector(0.0f);
    FRotator DesiredRot = m_moveInputXYZ.Rotation();
    if (!m_moveInputXYZ.IsZero())
    {
        SetActorRelativeRotation(FMath::RInterpTo(GetActorRotation(), DesiredRot, deltaTime, 10.0f));
        m_newVelocity = m_moveInputXYZ;
        m_newVelocity.Normalize();
        m_newVelocity *= MovementSpeed;
        FVector newPos = GetActorLocation() + m_newVelocity * deltaTime;
        SetActorLocation(newPos);
        FRotator worldRot = GetActorRotation();
        m_direction = worldRot.Vector();
        m_direction.Normalize();

        ReplicatedLocation = newPos;
        ReplicatedRotation = worldRot;
    }
    m_moveInputXYZ = FVector(0.0f);
}```

```c
void APawnAgent::OnRep_Position()
{
    SetActorLocation(ReplicatedLocation);
    if (GEngine)
    {
        GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::Printf(TEXT("rep Pos called")));
    }
}

void APawnAgent::OnRep_Rotation()
{
    SetActorRotation(ReplicatedRotation);
}```

this doesn't work. What am I missing?
#

i have already done ```c
void APawnAgent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);

DOREPLIFETIME(APawnAgent, ReplicatedLocation);
DOREPLIFETIME(APawnAgent, ReplicatedRotation);

}```

#

so you mean I should have changed those variables in one of those ServerMoveSomething_Implementation?

#

as that code is run by the server. I am trying to build up my fundamentals for it. Please ignore if it gets annoying

#

uhm, I was doing it through multicast but felt replication would be a better way to handle it

#

uhm! so you are implying I should rather go with RPCs instead of replicating variables on different clients.
Is there a reason for it? to avoid latency or something?

#

I see!
in this case - In the non-ideal case, such as the player making an invalid movement

Server sends player the "rolled back" state that they should be in since the correction was received - is the client trying to predict the next frames of the other clients?

#

I think I need to understand more fundamentals of it - apart from Multiplayer in Unreal

#

I get your point

#

let me see what it says!

#

btw I am not using any CMC in my game. My movements are fairly simple and didn't feel like I need it

#

yeah that file is just huge

#

my class extends the pawn class, not character

#

I deliberately did not extend it with character to avoid any bloating. The pawn's movement is very simple and my plan is to do the multiplayer part on my own

#

people suggest me to use CMC but I feel i should manually handle it. The movements are not complex and can be handled

#

uhm, I have heard it but in future I would need to handle more things in game apart from movements. I will need my knowledge there

#

Then people would suggest me to use GAS

#

So you are implying I should not know whatโ€™s going on and get it done with Unrealโ€™s tool! If something goes wrong in future then it will be extremely hard for me to know whatโ€™s wrong

#

Have you ever went down the path of writing your own client server code?

#

yeah but knowing what's going on would at least help to trim down what could be wrong

#

uhmmm, 6 months to understand what's going on behind to understand things deeply

#

you are right. I don't even have that kind of bandwidth

#

bleehhhhhhhh

#

I will then go with CMC and GAS after watching the videos you referred to me. In case - I accept they are really tough to handle on my own

#

because I can't make my own engine. Even with networking I want to use unreal's core networking but not use CMC or GAS as I think they can be handled.
It's like having a layer on top of a layer

#

you are right!
I thought if I could make it work without using CMC then it wouldn't be difficult to make things work apart from the movements as well.
This would give me the freedom I need at the same time.

#

but yeha

#

i get your point

#

I'll explore these things and decide what needs to be done

echo pasture
#

would fixing the chaos vehicle movement component to make it less buggy be a hard task

#

like is it worth it to try and fix or should I just use some other multiplayer vehicle movement component that's out there on the marketplace

echo pasture
#

that chaos vehicles are very jittery in multiplayer

#

and known to not "be very stable"

#

also how have you been it's been a while

chrome bay
#

They're jittery because people don't set them up properly and/or don't understand how the physics replication/interpolation works. With a bit of tuning it's pretty servicable

echo pasture
nova wasp
#

I imagine if you didn't need cheat prevention etc you could have the person driving sim it locally

chrome bay
#

The physics can be setup however you want, but the physics replication settings need to be set loose enough that your local sim can move ahead of the Server without being consistently snapped backwards.

echo pasture
#

ah okay gotcha

echo pasture
chrome bay
#

Not at all, you just replicate the inputs to them. Physics is "free" smoothing, they are simulating every frame regardless

echo pasture
#

but how would replicating the inputs be helpful if the simulation is not deterministic

chrome bay
#

The engine isn't deterministic, so even if physics was, it wouldn't matter.

#

The physics replication works by applying forces to make sure the sims converge to the "correct" server state over time, but it's heuristic in nature. Determinism is a wasted venture in UE land

echo pasture
#

oh ok I don't know anything about physics replication

#

that makes sense

#

and this heuristic will kick in for anyone who is not an authoritative physics mover I assume

#

and if you don't replicate input, that heuristic is gonna have to go work really hard or something

nova wasp
#

with async fixed mode of course

#

of course that's toast the second user input comes in and things get moved on the main thread randomly Sad_cat

chrome bay
#

Yeah, if you run async fixed it pretty much is deterministic, so long as you insert bodies into chaos in the same order (which in replication land is baasssicaly impossible)

chrome bay
#

And yeah by default, everybody tries to blend to the server state (even the autonomous proxy). You can disable this by unchecking bReplicatePhysicsToAutonomousProxy on the simulated primitive (as long as it's the root component) - but IIRC you need to make sure the server just "accepts" the controlling clients data if you do that

#

Which is basically client-auth at that point

nova wasp
chrome bay
#

The only massive problem with the engines current physics replication is you are limited to global settings for every physics sim, which is dumb. Should really be able to have different groups of settings

nova wasp
#

I am hoping to get away with a "I don't need bitwise but I am going to get damn close" setup

chrome bay
#

yeah, honestly that's been fine for me in all the stuff I've done

#

never going back to kinematic vehicles smiletears

nova wasp
#

also with true rollback you basically say "time to resimulate this" and have to rerun the tick 10 times

#

this is not so nice in a complex 3d game

chrome bay
#

Epic are putting a loooot of work into their physics networking tbh, I think they really want viable physics-based characters

#

But it's all heuristic in nature

nova wasp
#

I think with some fanagling you could get there (I run my entire game tick on tasks and I could interleave them) but... it's super doomed if a client can't keep up with that

chrome bay
#

yeah

nova wasp
#

of course this is no joke to just slap in but interpolating things generically is already in the engine...

chrome bay
#

yeah, well that's how the async stuff does it IIRC, you have the physics running at fixed step and GT data is interpolated

nova wasp
#

I suppose if they buffer literally any change to physics state then it's probably all gucci

chrome bay
#

yeah

nova wasp
#

problem is games are not all physics and you need to run some game rules on the fixed tick if you want to do more than watch blocks collapse

#

I'm sure it can't be worse than the existing "cowabunga" physics replication setup where things jitter by default

#

you could sacrifice some immediacy to get smooth interpolation I suppose (buffer known good states)

#

of course you would occasionally get wacky "wiggling" on things but it would beat the flickering around

upbeat basin
#

Is it possible to let players stay in their current level in standalone when connection is lost?

echo pasture
#
void UOnlineSessionClient::OnDestroyForMainMenuComplete(FName SessionName, bool bWasSuccessful)
{
    UE_LOG_ONLINE(Verbose, TEXT("OnDestroyForMainMenuComplete %s bSuccess: %d"), *SessionName.ToString(), bWasSuccessful);

    IOnlineSessionPtr SessionInt = GetSessionInt();

    if (SessionInt.IsValid())
    {
        SessionInt->ClearOnDestroySessionCompleteDelegate_Handle(OnDestroyForMainMenuCompleteDelegateHandle);
    }

    UWorld* World = GetWorld();
    UNetDriver* NetDriver = World ? World->GetNetDriver() : nullptr;
        
    // Call disconnect to force us back to the menu level
    GEngine->HandleDisconnect(World, NetDriver);

    bHandlingDisconnect = false;
}
#
 * Transition from destroying a session to returning to the main menu
 *
      * @param SessionName name of session recently destroyed
     * @param bWasSuccessful was the destroy attempt successful
 */
void OnDestroyForMainMenuComplete(FName SessionName, bool bWasSuccessful);```
#

I'm not a multiplayer expert, but it does look like this is the code that is calling that transfer to the main menu? So i'd say a good starting point is removing this function from the delegate, or something like that

#

You'll at least need to Use your own implemenation of UOnlineSessionClient

thin stratus
#

If I have X Components on the same Actor, which all need the same Integer to be replicated alongside their data, is there any other option than pushing the Integer into each set of Data?

#

The Integer exists "globally", and I currently have to pass it along each Components Serialized Data, to ensure that I have it available on the Client then when processing the Data.
But it feels shite that I have to spend bits on X - 1 copies of Data being sent.

tardy fossil
#

what about replicating it in the game state class or something and having the component grab it from there when its created? not too sure if that would be any better.. i suppose it depends on how many actors use that component

thin stratus
#

The Integer changes constantly alongside the Data of the Components.

#

Moving it out of the Actor itself is probably worse.

#

It's the current FixedTickFrame basically.

#

The Data gets mapped to the Frame.

#

But given how Replication works, I have to tell each Component the same Frame.

sweet sage
#

What is the best of benchmarking dedicated server? what is the best way of running super lightweight clients?

#

Do i need a lot of rendering clients to benchmark a server?

silent valley
sweet sage
silent valley
#

No, Unreal Insights is the profiling tool. You would start by launching dedi server and profiling that without any clients.

#

Then I launch/connect a client via a batch file that I can run as many times as I want

sweet sage
#

This is not what i need, and i want to "benchmark" it at release

#

without a profiling tool

#

I can already check bandwidth/cpu usage on my server but i can`t really connect a lot of clients on it

#

Because each client is expensive to render

silent valley
#

so use -nullrhi when launching a client so it's free to render

sweet sage
#

Is it expensive to process?

silent valley
#

depends on your code ๐Ÿ™‚

sweet sage
#

Is it realistic to run 100 under a single machine

silent valley
#

I doubt it

#

maybe 10

sweet sage
#

I will try

#

10 is nothing

silent valley
#

you'll probably need to get some more machines then

#

for me running one nullrhi client uses about 10% CPU

#

maybe you could throttle the update rate to improve that?

sweet sage
#

I have 32 cores here, maybe i can run 100

#

ryzen 7950x

silent valley
#

maybe ๐Ÿ™‚
depends on your game really

sweet sage
#

It is a mmorpg

silent valley
#

I mean depends on what is happening in your game. Running lots of clientside logic/etc.

sweet sage
#

It is default cmc, some c++ logic

#

It is not heavy

silent valley
#

If you've never done it, I would recommend profiling your server in detail with just a few clients. You can capture with 1 client, then capture with 2 and see what is scaling up linearly.
I found lots of low hanging fruit for server optimization when I did that.

sweet sage
#

I have tried already 20 real players but not 100

silent valley
#

I mean using Unreal Insights to capture accurate timing for all parts of the game.

#

Honestly I can't really remember it was many months ago. Let me think...

#

things like: Turning off overlap events, bEnableUpdateRateOptimizations, OnlyTickMontagesWhenNotRendered, tick rate of logged out players, lowering NetUpdateFrequency, many things!

#

You never know what you're going to find when you profile which is why I strongly recommend it even with just 1 or 2 clients

sweet sage
silent valley
#

Fair enough, bear in mind that the Unreal server is very good at hiding when it is overloaded, it just starts throttling updates etc. And it's probably 90% busy on a single core so if you are checking VM stats on a multicore machine it might look underutilised but one of the cores could be 100%.

sweet sage
#

Can i configure min updates/second?

#

What do you recommend?

silent valley
#

You can't configure a minimum because it depends how long the server frame takes.
I recommend optimizing as much as possible to keep your tick time below a threshold.

#

Would make sense to configure the Max tick as low as possible for your style of game too so it has a consistent rate. For FPS you might want the server to run at 60, but for MMO maybe 10 or 20 Hz is ok.

#

configure via NetServerMaxTickRate in DefaultEngine.ini

sonic obsidian
#

should OnRep functions be marked as UFUNCTION?

silent valley
storm pollen
#

Guys, how do I prevent player controller from getting destroyed after player leaves? I have tried to add this and it still does not work:

thin stratus
#

And on top of that, is the Pawn referenced anywhere else? Otherwise it will be removed by the GC at some point.

storm pollen
#

yes

#

it used to work

#

then i renamed project

#

now its broken again

thin stratus
#

Renaming the project can f'ck up the references

#

Make sure the Controller, GameMode, etc. is all still spawning properly in your Outliner.

storm pollen
#

i will try to create this class again

sweet sage
#

By realistic i mean using CMC but state of art code, viable

silent valley
#

I don't know tbh. Maybe with a low tick rate and lots and lots of optimization.

thin stratus
#

Most games, even with heavy optimization, have 100 as a limit, before they need to use custom Servers.

silent valley
#

They probably have their own server infrastructure

sweet sage
#

I don`t think Mortal Online has custom server because it is a indie mmorpg with precise collision

#

It is not tab target, imagine doing all this collision check on a custom server

thin stratus
#

As long as you can't share something from them proving that they use native servers, I would say they aren't doing that.

storm pollen
thin stratus
#

Yeah but that's not Unreal Engine, so why does that matter

silent valley
#

Ok I had a quick look and looks like they have a somewhat custom architecture.
ClusterNode runs part of the world and they have multiple ones of these, with an overall server managing players between these instances. It's likely each node is more limited re: players.

thin stratus
#

Chances are higher that they use a custom server setup that they integrated on C++ level. UE has all options open for that if the programmer is capable of doing so

thin stratus
#

There are also a bunch of networking solutions that allow for more players.

#

UE's Servers come from a time where Online Games were mostly Arena Shooters (Unreal Tournament says hello)

#

Which often were having around 32 to 64 players, depending on the Game.

#

100 Players was only pushed via RepGraph implementation a few years ago via PUBG and Fortnite

#

It's unrealistic to assume that the native replication model can handle much more than that.

sweet sage
#

It quantize the data a single time instead of one per viewer and also has repgraph grid partitioning

silent valley
#

I don't think anyone knows for sure if it's possible, you'd have to try it.

#

It's just unproven,

thin stratus
sweet sage
#

I don`t know what large server setups is, a new netcode or what?

thin stratus
#

I would need to look it up. Nothing that is released.

cloud crown
#

Just a question i am using object reference for my inventory system should I switch to class reference

thin stratus
#

iirc they are working on something to support their deal with Disney or whatever it was.

thin stratus
sweet sage
#

It is like using mass entity for all your code

thin stratus
sweet sage
cloud crown
# thin stratus Depends on if you need either. Can't really answer that.
{
    TArray<AItem*> MatchingItems;

    // Iterate over the inventory and find items that match the given icon
    for (const TPair<AItem*, int32>& ItemPair : InventoryMap)
    {
        if (ItemPair.Key && ItemPair.Key->Icon == Icon)
        {
            MatchingItems.Add(ItemPair.Key);

            // If we've reached the requested number of items, break out of the loop
            if (MatchingItems.Num() >= NumberOfItems)
            {
                break;
            }
        }
    }

    return MatchingItems;
}
``` for context
thin stratus
#

I mean, that's Actors and not Objects

#

Also, first time I ever see someone querying an item by a Texture.

cloud crown
sweet sage
cloud crown
#

Name tag category image weight space

velvet current
#

hey i have this update gravity event that multicasts, but my server doesn't like it. my client sees my server smoothly. why might they be out of sync? network emulation is disabled.

crisp shard
#

you could try to do it locally and on the server and see if that helps tho, i have some quick movement things that i do locally first then and then server, but these are short bursts and when testing w network emulation there are some sync errors at 100+ ms ping

sweet sage
#

For anything movement related you need c++ and the MovementData thing

#

SavedMove*

lament cloak
#

Any good Iris cheat sheets and tutorials out there? Specifically interested in spatial filters right now

velvet current
crisp shard
sweet sage
#

Maybe it works

crisp shard
# sweet sage Have u tried changing it on client side only?

that's what i was thinking, cuase if you change it locally, technically the movement should be replicated to the server by defualt as you are the one controling the movement and maybe then just doing the same function/logic on the server just to ensure server is aware that you did that change. definitley not the best appraoch but could work

sweet sage
#

Yeah, GravityDirection is replicated on SavedMode

#

Actually i will strip this saved mode down unless i use mover 2

#

It has a lot of data

lament cloak
#

Also, anyone who has knowledge on the reason why Iris exists, and why you'd use it over the Replication Graph would be super helpful.

Are they working towards deprecating the Rep Graph?

velvet current
# sweet sage Have u tried changing it on client side only?

I will try when I get home. But I donโ€™t have separate BPs for client and server (am noob) so I might just scrap this and start over with a template I have that has special movement replicated and try to iterate off that.

I thought multicast changed it on both client and server

magic vessel
#

I'm trying to add to the Player State's built in Score member, but when I try to seamlessly travel to the next map the score is reset


bool URewardObject_Score::CommitReward_Implementation(UObject* RewardTarget)
{
    const bool& bResult = Super::CommitReward_Implementation(RewardTarget);
    if(bResult && RewardTarget->Implements<UQuestComponentInterface>())
    {
        UE_LOG(LogTemp, Warning, TEXT("URewardObject_Score::CommitReward_Implementation"));
        // Give score to player
        APlayerState* PlayerState = IQuestComponentInterface::Execute_GetPlayerState(RewardTarget);
        if(IsValid(PlayerState))
        {
            UE_LOG(LogTemp, Warning, TEXT("URewardObject_Score::CommitReward_Implementation IsValid([%s] - [%s])"), *GetNameSafe(PlayerState), *PlayerState->GetPlayerName());
            
            PlayerState->SetScore(PlayerState->GetScore() + ScoreToReward);
            
            UE_LOG(LogTemp, Warning, TEXT("URewardObject_Score::CommitReward_Implementation PlayerState->GetScore(): [%f]"), PlayerState->GetScore());
            return true;
        }
#

It's a valid player state, and it gives the correct score at the end, but it seems to reset after this point

carmine ember
#

Is there an established pattern for configuring a multiplayer match before loading the level?

E.g.
When going from lobby to in-world match, pass some data that was queried from a web service, so that when the level is loaded, the data can be used to change materials on BeginPlay?

velvet current
velvet current
#

as you can see, mvoement on the server comes back to the client though.

#

i might just be smooth brained here... forgive me if this is an obvious question... but do i need to run the event locally, unreplicated, and then simultaneously (or as close to it as possible) on the server, on a second event?

velvet current
crisp shard
velvet current
unborn nimbus
#

I feel like I'm blind because I'm looking for what I imagine is a relatively common problem

#

I want to lock the FPS of the listen server so if the player alt tabs, it doesn't drop to 4fps. how in the world do I do that in UE5?

#

was simple in UE4.

lament cloak
#

Making some progress with Iris, but one thing that's unclear to me is how to do ordering, if possible.

For example, I'd like to "send" the PlayerController over before other actors. Pre-Iris we were accessing the GetFirstPlayerController() in BeginPlay() on some actors. Somehow, in PIE that was actually working on actors that already existed in the map.

With Iris, its not available yet ๐Ÿค”

hollow eagle
#

Replication ordering has never been guaranteed.

#

Not with iris, not without iris.

magic vessel
#

I think I've found the source of my problem

void APlayerController::SeamlessTravelFrom(APlayerController* OldPC)
{
    // copy PlayerState data
    if (OldPC->PlayerState)
    {
        OldPC->PlayerState->Reset();
        OldPC->PlayerState->SeamlessTravelTo(PlayerState);

        //@fixme: need a way to replace PlayerStates that doesn't cause incorrect "player left the game"/"player entered the game" messages
        OldPC->PlayerState->Destroy();
        OldPC->PlayerState = NULL;
    }
#

That reset is setting the Score to 0

#

Why is it there? Why would you want to reset the values before a seamless travel?

twin juniper
# sinful tree That's basically how it would need to work if your intention is to have lots of ...

I already have the chat developed and working, I did it with node js. Thank you very much, it is partly what I had in mind to do, unfortunately I do not have much knowledge but luckily what you told me is very similar to what I had in mind, I made myself a "manager" that according to the capacity of the server it triggers a request through an api informing if it is full or about to be completed and that manager is in charge of opening other servers in the instance where it is hosted. and at the same time it adds to a database the IP where the new server is created and the clients before connecting to the server (with open world) through another query obtain the server to which they can connect. Thank you very much. Sorry for the delay in answering

lusty aspen
elfin creek
#

i have a widget that shows the connected players with their hp bar and icon that are in the same team, the players don't join the session at the same time and player team could change at anytime, this also applies to ai characters that has the same team as the player, my question is what is the best approach to update the UI with the new members and remove the old ones ? i thought of making it as periodic check to see the changes through getting all actors that has the team interface but i don't really think this is a good approach, also when is the best time for a client player character to broadcast that the player is in and has his character ready ?

teal frost
magic vessel
lament cloak
# hollow eagle Not with iris, not without iris.

I was surprised to learn we were accessing it in BeginPlay() right off a PIE boot. It made me think maybe there's something special going on with the PC specifically as part of the initial handshake.

#

I tested it under really shitty connections and couldnt break it

#

either way, its a bit weird expecting anything to be ready like that so I've already started on the fix

tropic beacon
#

I cannot for the life of me figure out why the host character is lagging behind and moving through the canoe when paddling. This is only happening on the joining players screen. On the host screen everything works, on the joining it is the host that is desynced. Host on right, joining client on left.

vapid gazelle
#

Where do developers typically keep the "rules" of the game when it comes to multiplayer games? E.g. say you're implementing an PvE extraction shooter, where do you keep logic like "has the whole team died? Ok we got to restart the round", or "the team ran out of time, let's restart" or "they reached the objective, let's finish the game".

Is that typically handled by game mode? Or do people perhaps spawn some kind of a "rules manager" actor that takes care of this? Or the game state? Curious if there are best practices here.

modest crater
# vapid gazelle Where do developers typically keep the "rules" of the game when it comes to mult...

Game Mode defines rules that are governed by the authority instance, game state represents the state of the match, still authority ruled but this is replicated to all clients unlike the game mode, so you have different states you can be in, for example you can be in the RestartingMatch state, unreal has basic state stuff in its AGameMode and AGameState (not their base ones, but the class just after that) but I had to basically just re write my own state and game mode system ontop of the base classes just using AGameMode and AGameState as a reference to see what I should be doing

vapid gazelle
#

Sounds like game mode can own everything as long as the clients don't need access to some shared data across players, and as soon as that's the case, you want to start moving information into game state?

Either way it sounds like the game mode is the thing doing the starting, resetting, and overall judging of a "match"?

modest crater
# vapid gazelle Sounds like game mode can own everything as long as the clients don't need acces...

Technically I think its the AGameSettings or whatever that dispatches the beginplay/restart stuff to all actors in the world, if you had the game mode do it, idk if it would replicate properly, you would have the game mode change the game state and the game state would then replicate to all, from there its all on you to respond to new "Match States", for example I have this concept called a ClientBeginplay, which is an extra level I have between beginplay in the world and actually playing the game, it allows me to do some init and RPC setup stuff with clients before the start playing, then I change the match state to ClientBeginplay which replicates and when the clients get that event I fade in the camera and give input back. Unless you want a literal hard like level opening restart, you would need to implement what it means to "restart" the match within your own game

hushed sierra
#

I have a 3D widget component that has "Recieve Hardware Input" enabled. I am able to click/hover over it successfully as the server, but clients don't seem to affect it at all. I'm doing an RTS style top down camera, so I'm trying to use the mouse instead of a pawn with a widget interaction component. Am I doing something horribly wrong?

pseudo wagon
thin stratus
tropic beacon
# pseudo wagon You snap to the boat, so in the right is the correct state when you attach to ac...

so the initial attachment works perfectly, but I have done some testing. I sped up the animation by 5x and the thingsseemingly works now. or at least much better, but the animations are so fast I cant really see them that well. However, I have started looking into root motion animations and the issues they can cause. This is why ignore client error correction fixed the joining player desync.

tropic beacon
#

disable root motion notify fixed it, wow this took me like 2-3 days

cold cipher
#

sometimes the a bullet seems to deal multiple damage at once (I checked only server can spawn so there should be only 1 target) unless the bullet is shot at point blank
and client can deal damage to them, but only the owner can kill them

sinful tree
#

If not, then it's likely because you're detecting the hit on both the client and the server and doing something then on both.

keen marlin
#

can a UserWidget execute a function on server to run a multicast on all client ?

#

thank for helps

nova wasp
#

short answer: no
(not without somehow making it a replicated subobject but that would be very, very weird and I don't think any project I have worked on does this)

put the data that needs to replicate in an actual actor/actor component/replicated subobject

karmic venture
#

Hi. does anyone know why I can't find/see/join sessions in packed build? I tried the same PC, 2 different in the same network, online, Lan. It works fine in editor

sweet sage
#

Is there any way to check if AActor is replicating to any connection on Iris?

ruby lodge
#

I am having an elevator in my game that takes players to a different floor with each floor having an own mode. Previous floors are not accessible anymore after they have entered the elevator. There should not be a loading screen or a freeze between levels and players should be able to move freely inside the elevator while they wait to reach another floor. I am thinking about an approach on how to handle this and thought about this:

  • level stream the different floors and unload them again once finished
  • Put the elevator into the persistant level

The problem I am having though is that sometimes there happens a little freeze and also most importantly, I have different game modes and game states for each mode on the floor and don't know really how to run those once the elevator reaches the corresponding floor. Furthermore, maybe the elevator could be static and not move really but once the players are inside of it, it's surroundings change. Finally, this should work for a multiplayer environment.

velvet current
#

If I have a physics ball that needs to be updated all the time, is there a better way to do this than event tick? on my local server with latency emulation, it works pretty well, but everyone always says event tick bad

#

like if i need the exact world location sync'd, why shouldn't the server update the location of the ball for all clients, all the time?

latent heart
#

If you have to do something every tick, use tick.

#

The question you have to ask is not "is tick bad?" but "why do I need to do this every tick?"

#

If you use tick for something that doesn't need tick, that's where you get problems.

dusk fable
#

anyone have any idea why animation blueprint do not replicate ?

player basically press button to use flashlight , so character plays the animation , so it jumps to the "holding flash light "idle animation , everything works fine for the client and the host's pov , but the host cant see the client in that state and vice versa

upbeat basin
#

Multicast RPCs are sent immediately compared to setting a replicated variable and not knowing which next frame they will be replicated right? I want my variable to be replicated with onrep function since it's a state, rather then sending it with a MC RPC, but would prefer it to be replicated immediately/faster than normal replicated variables. Is it possible to trigger replication of a variable as soon as the it's set like it's an RPC?

#

Oh or am I wrong? UE2 documentation states that replication is done at the end of the tick, if that's the case that's good enough for me

#

I thought variable replication were done every few ticks or time according to net update frequency

upbeat basin
#

Couldn't find any information on the current docs

teal frost
#

But to answer I don't believe any replication Is instantaneous.
Which is why client prediction/server rollback is so important for competitive multiplayer.

The way replication works in general is that the client receives the input/command for an action.
The client has to send that to the server for validation and to run whatever code/set whatever. Then depending on that, the server can send that information back out to that player and or all players.

Depending on location, connection speeds, etc determine how long it takes for these signals to be sent/received. Which is your latency or ping. (How long it takes to send and receive data to and from the server)

Tldr;
Your connection/programming is what really controls the speed of replication but it won't ever truly be instantaneous.

There shouldn't be any real difference in replication method unless you're coding it to have delays or something.

silent valley
echo pasture
tropic beacon
elfin thicket
#

Does anyone have any good source of information on Iris, I have enabled it and tested it - and it works. But I assume it's not that easy to migrate by just enabling it? Had some small error where I didn't add a component to the replicatedSubObjects but that was it ๐Ÿค” . If anyone can point me to some good documentation I would be forever thankful

echo pasture
teal frost
tropic beacon
teal frost
crisp copper
#

i tried setting up listen server replication, but for some reason it only works one way. its mini golf, and both players bp spawns an actor, the ball, and on the clients, i can see my server/host movements on the client, but the hosting player/listen server isnt receiving anything from the client. anyone have any idea whats wrong? ive tried to research this for a whole day. i have tried every single combination of the replication settings in the actor.

nova wasp
#

from server to clients

#

if clients want to tell the server anything it must be a client->server RPC

usually prefixed as "ServerDoThing" in C++ as it runs the _Implementation on the server

#

for example, character movement is a bunch of server rpcs received from the controllering client that tell the server where you say you want to move

crisp copper
#

im doing it in blueprint currently as i dont need anything advanced and i just started using c++ in UE (been learning it outside of it slowly for some months)

#

and ALL i need is to update the locations of the balls and display them

#

but so, do i need to do it manually by calling an event to update the position? i thought it could be just handled by the replication settings in the actor because its working the other way, like i can see the movements of the hosting player on the clients

sinful tree
#

If you want a client to tell the server something so it can replicate to everyone else then you must send it through an RPC on a replicated actor or actor component that was spawned by the server that the client owns or if it was spawned on the client, that a copy was spawned on both the client and server and has been set up to be net addressable. The common actors that are always owned by a client are their controlled pawn, their player controller or their playerstate.

This can mean that you don't necessarily want the movement to happen on the client either, you may want the client to be able to tell the server, "Hey I'm hitting the ball now" and then the server can interpret that request based on the current direction and calculated power of the swing and simulate and move the replicted actor itself.

If you're trying to move the ball first on the client, and then have it sent out to everyone else, that's possible too, but it's generally easier just allowing the server to perform the movement.

#

@crisp copper ^

crisp copper
#

thanks

#

but are the physics 100% deterministic? like if i shoot the ball on the client, and then its shot with the same parameters on the server and replicated for other players, will the swing performed on the server be 100% the same? as in the end location

teal frost
sinful tree
# crisp copper but are the physics 100% deterministic? like if i shoot the ball on the client, ...

No. There could be things that are in different positions on the client than what the server has currently and there will always be some small offset due to latency. That's generally why it's better to have the server replicate the movement for you rather than moving it on the client as then anything that is moving with server's authority it should line up correctly on the client too, assuming everything is correctly synchronized.

So if you were trying to "time" a shot through a windmill hole, but were relying on the client to move it and allow it to replicate to everyone else, then on other people's screens it could look like the ball passes through windmill blade, but meanwhile on the client that hit the ball locally it would look correct. If it was server authoritative movement, then it would appear the same for everyone, assuming that the spinning of the windmill blades is synchronized correctly on all client machines.

teal frost
crisp copper
#

also if its server authoritative, wouldnt that mean that the player would have insane input latency as after you do an action, it would send it to the server, do it there, and then send it back to the client?

teal frost
crisp copper
#

and doing it in a way that doesnt have latency (predictive and then possible correction) would be extremely difficult and require extensive usage of c++

#

this is primarily a practise project, but i will be playing it with some friends who live far away, ping would easily be over 200ms

sinful tree
#

There is always way you can try and compensate to make it feel better, like you can actually make it -start- to move on the client, but then replace it with the server's position once it knows its in flight.

crisp copper
#

but for an example like the example you provided, the windmill, you need to time it, so 0.3 seconds might make you hit the blade

sinful tree
#

But that's the thing.... Which copy of the blade then are you going to rely on? The server's copy or the clients?

crisp copper
#

if you rely on the server, then it wouldnt work because when you shoot, when the server receives it, the blades will be in a different position

#

or am i missing something?

#

i dont mind if other players see it going through stuff, so would it work if i just manually call and event every frame to update the other players positions?

sinful tree
crisp copper
sinful tree
#

No, they can't check on other clients.

#

It can only be checked by the client making the ball move.

crisp copper
#

yes thats what i mean

#

thats fine

nova wasp
#

One thing you could do is have a shared "accurate" time where the person shooting sends you the offset of overall time when they hit the ball to move things to that time in the timeline

crisp copper
nova wasp
#

BP doesn't really limit you here, it's all just floats and timelines ultimately

#

with C++ you get more control over the extra unique ways to control replication conditions/raw serialization but I don't see how BP restricts this

#

assuming the bandwidth cost with the naive approach isn't high enough to matter

crisp copper
#

okay, but still its too complicated for me. i would have zero clue where to start or what to actually do.

nova wasp
#

Fair enough... making multiplayer is always complicated inherently so don't feel discouraged I guess

split forge
#

proud of you guys, just figuring out basic blue prints so keep up the good work lol its rough

torpid lantern
#

I just found a nasty oversight and I am not sure how to address it. Would appreciate some high-level guidance.

My server has resources (trees & rocks), these are all ISM using PCG.

When the player whacks a resource, I spawn an actor (BP_ResourceTarget) at that location. That actor manages state/hp for the mesh and when hp = 0, the mesh Multi-Casts a destruction animation and moves the ISM -5000 under the map.

BP_ResourceTarget then destroys itself - otherwise I found my server performance takes a dive after 200+ trees are whacked.

I am only now realizing that the Multi-Cast won't work for late joiners. The tree meshes remain on client, but not on server. The player will not collide with the meshes and can walk through the trees.

I think OnRep is the answer, but I am concerned with 300+ OnRep tree vectors.

Any suggestions?

fossil spoke
torpid lantern
fossil spoke
#

No, dont do that, its actually better for you for it to be static

#

So

#

Instances within an ISM have an ID

#

Its just an Integer

#

For Instances that get "wacked"

torpid lantern
#

Aye, that's how I move them under the map.

fossil spoke
#

You can replicate the InstanceID

torpid lantern
#

Oh, smart.

fossil spoke
#

So when a Client joins later, you can use the ID to remove the ISM instances that were "wacked"

#

Thus keeping them correctly in sync

torpid lantern
#

How would I store all the IDs, would that just be an replicated array of ints?

fossil spoke
#

Yeah

#

You might want to consider removing the RPCs

#

And just use the Array of IDs to identify which Instances need to play animations

#

The Local Client can probably predict the removal

#

Remotes would wait for the Array to change

#

To know which ones to destroy/remove

#

Its also better to play a Particle effect instead of animate the ISM instance

#

The instance just gets hidden or removed immediately

#

Then the FX is played ontop of it

#

Much more performant

#

You will want to also look into using a FastArray

#

It will make your life easier

torpid lantern
#

Okay, noted. I don't know much about FX or prediction, but this is good homework.

fossil spoke
#

If you are clever enough, you can probably make this a generic enough system to apply to all your resource types, not just trees

#

But yeah, there is a lot in what I just outlined.

#

So good luck.

#

Its very doable.

torpid lantern
#

Thank you Matt!

fossil spoke
#

๐Ÿ‘

crisp copper
#

any idea why my cast fails? can i not cast to a blueprint from the server, thats on the client?

thin stratus
#

And then the Tick is probably calling right from the start, where the Ball is not valid yet.

And last, the Ball variable isn't replicated, so the Client will always have it invalid in tick.

crisp copper
thin stratus
#

self is redundant here

#

You are in "self"

crisp copper
#

but it doesnt cast to the same blueprint. its the same name. this is the very reason we need object references in casts, cause there can be multiple instances. in this case, one on the host, one of the client

thin stratus
#

self is a pointer to the instance that calls the code. this in in C++.
If you have two Actors in your Scene, of the same (BP) Class, and you call your code in Actor_1, then self is that Actor_1 Instance.

Calling a ServerRPC in Actor_1 on Client-side will move to the Actor_1 Instance on Server-side. There is no need for passing self.

crisp copper
#

and i need a reference to the client BP_Player

thin stratus
#

That's not how that works

#

When you pass self there, it will send a NetGUID to the Server that is resolved tot he Instance on the Server-side

#

it's impossible to get access to the actual Instance of the Client.

#

That sits on the Client's PC in the RAM.

crisp copper
#

ohhh okay, i didnt know that

#

thanks. im gonna try to think of another solution

thin stratus
#

Whenever you pass any kind of replicated Actor reference via replicated Variable or RPC, you only send an ID that Server and Client agreed on to identify the Actor

#

That ThePlayerBall variable has to be marked as Replicated.

#

EventTick calls on everyone (that has an Instance of the Actor), but your Spawn code is triggered only on the Server (which is correct). You have to mark the Variable as Replicated, otherwise it will be null on the Client.

#

The Cast in your Tick will not work on the Client due to that.

crisp copper
thin stratus
#

No?

#

You have a bigger misunderstanding of how that all seems to work and align.

#

BP_Player is a PlayerController I assume?

#

Or a Character/Pawn?

crisp copper
#

a pawn

thin stratus
#

Okay, and BP_Ball is the GolfBall.?

crisp copper
#

yes, an actor

thin stratus
#

I assume both are set to Replicate in their Settings.

crisp copper
#

yes

#

and it only works one way

thin stratus
#

Okay, so let's say you have 2 Players, and for simplicity, let's say you use a DedicatedServer, and not a ListenServer.

crisp copper
#

on the host, i can only see myself, on client i can see host ball as well as ofcourse the clients ball, and their movements

thin stratus
#

The Server will spawn 2 BP_Player, one for Client_1 and one for Client_2.
Due to the replication part, Client_1 will get an Instance locally spawned (due to replication) of their own BP_Player, let's call it BP_Player_1, and it will receive a version of Client_2's BP_Player, let's call it BP_Player_2.

#

The same goes for Client_2. The result are the following instances on the given Targets/PCs/Players:

Server: BP_Player_1 (Client_1), BP_Player_2 (Client_2)

Client_1: BP_Player_1 (Owner/AutonomousProxy), BP_Player_2 (Client_2/SimulatedProxy)

Client_2: BP_Player_1 (Client_1/SimulatedProxy), BP_Player_2 (Owner/AutonomousProxy)

#

Client_1 can only call Server_RPCs on Actors they own, so BP_Player_1 in this case.

#

When calling a ServerRPC on BP_Player_1, it moves the call, over the Internet or LAN, to Server, and that resolves the NetGUID and calls the function in its own version of BP_Player_1.

#

If the Server now spawns BP_Ball_1 for Client_1 in BP_Player_1, it will again also replicated to everyone else, due to Server spawning a Replicated Actor.

#

If the Server, after spawning BP_Ball_1, inside BP_Player_1, sets the ThePlayerBall variable, it will be set on the Server version of BP_Player_1 to the BP_Ball_1 instance.

If you mark the variable as replicated, it will (if both Actors are replicated, which they are), replicate the pointer to BP_Ball_1 down to the two versions of BP_Player_1 on Client_1 and Client_2.

BP_Player_2 will not have that variable point to BP_Ball_1. That will get its own BP_Ball_2.

#

And as previously set, any kind of Replicated Reference to an Actor gets turned into a NetGUID that will be resolved on the other side. So BP_Ball_1 will ultimately be spawned locally on the Clients too, and will be connected through an agreed on NetGUID. When setting ThePlayerBall in BP_Player_1 to BP_Ball_1, it will replicate the NetGUID, which will resolve on the other end to a pointer to BP_Ball_1 in the player's PC Memory (RAM).

#

This might be a bit tricky to wrap your head around at the start, but it's somewhat crucial that you understand that.

crisp copper
#

ohh okay. thank you very much for the comprehensive answer. i feel like i understand the process slightly better now.

thin stratus
#

For a ListenServer, this works similar, but there the first list would look like this:

ListenServer: BP_Player_1 (Owner), BP_Player_2 (Client_1)

Client_1: BP_Player_1 (ListenServer/SimulatedProxy), BP_Player_2 (Owner/AutonomousProxy)

crisp copper
#

would you say its easier to setup a dedicated server? i do have one extra pc laying around. its quite bad but could probably handle 2 players

thin stratus
#

That has nothing to do with Easier or not.

#

The Code is somewhat similar, maybe easier, but you should only use DedicatedServers if you really need them.

#

Someone/something has to host those.

#

And it's more annoying to develop with them if you are a beginner due to requiring to download the Source of the Engine.

crisp copper
#

oh okay. and just to confirm, if a client spawns an actor (which is set to replicate), it wont replicate to the host right?

thin stratus
#

If you can use ListenServers, do so.

thin stratus
#

That's the concept of Authority. Client's need to ask the Server to do things that are visible to everyone. And that's usually done through a ServerRPC.

#

That said, 90% of ServerRPC uses usually fall into telling the Server to do something based on a KeyPress or UI Interaction.

crisp copper
thin stratus
#

One should never use a ServerRPC to tell the Server to, e.g., apply damage to an enemy.

#

The ServerRPC should be the Key Press that fires the current weapon.
After which the Server can fire the weapon if allowed and damage the enemy.

#

And then we get into prediction to make the delay not feel that bad for the Client that pressed the key (cause the RPC to the Server and the result of the damageb ack to the client is of course delayed by Ping)

#

But that's a story for another day.

#

You code at the top of the screenshot for example looks like it is probably wrong :D

crisp copper
thin stratus
#
  1. BeginPlay should not be used to add MappingContexts for Input. BeginPlay calls on every Instance of the Actor, similar to Tick, and on BeginPlay, the Client most likely doesn't know yet if the Actor is locally controlled by itself to ensure the IMC is only added on its own end.

  2. Since BeginPlay calls on every instance, and you only want to spawn the Ball on the Server, you don't need that RPC at all, just the Authority part that already spawns the Ball.

#

For the IMC, you should use the OnControlledChangedEvent or whatever it is called. It's a function/event if Pawn that you can override. It calls on Server and Owning Client (not on other Clients) and gives you the new Controller, which you can then cast to PlayerController and use IsLocalPlayerController to filter only applying the IMC to the local instance.

#

And for 2. you just cut the RPC

crisp copper
#

but all the balls need to be spawned on the server right? if i remove the rpc, how will the client be able to spawn its ball on the server?

thin stratus
#

You are already spawning the Ball

crisp copper
#

yes, once, for the player hosting

thin stratus
#

This is indentical to the ServerRPC. The Server will spawn teh ball twice.

#

That's not what SwitchHasAuthority does

upbeat basin
thin stratus
#

If you have two Players, one ListenServer, one Client, you have BP_Player_ListenServer and BP_Player_Client_1, based on previous explanation, right?

crisp copper
#

yes

thin stratus
#

ListenServer and Client_1 both have an instance of each of them, right?

#

Which means BeginPlay, inside BP_Player, will call 4 times (if you'd print a String in it).

#

Twice on the ListenServer, once for BP_Player_LIstenServer and once for BP_Player_Client_1

crisp copper
#

wait what? im so confused : D

thin stratus
#

And twice on the Client_1, once for the replicated BP_Player_ListenServer and once for the replicated BP_Player_Client_1

#

Yeah I know what part you are struggling with, but that's not so straight forward to explain.

#

Put a PrintString on the BeginPlay node, right at the Start. And print the DisplayName of self.

#

And see what it prints for you.

#

Maybe that helps.

thin stratus
#

You should always use Functions and Variables that have that "ensured guarantee" build in.

crisp copper
#

ill try that in a bit, im not home at this moment, but thank you, while im still confused, i do have alot clearer understanding of the system now.

thin stratus
#

I need to head out and walk the dog and then have an appointment. Will be back later.

cobalt notch
#

The easy way is the controller when it possesses it then this gets set so save it then. I do not think this is a replication or multiplayer issue. It's just not possessed on beginplay even in single player.

upbeat basin
#

Oh if it's the missing controller that causes the check to fail, I want to ask if it would work during gameplay, when controller already exists

#

Or is the actor's replicated spawn on client and it's net update are different stuff which causes it?

cobalt notch
#

Yeah initially it's maybe not possessed on beginplay then it gets possessed. You can put a print statement for the controller it will have an AI controller on beginplay, not local player.

upbeat basin
#

Yes but all possess does that makes a pawn "locally controlled" is to set the owner as itself (controller). So giving the controller as the owner during spawn wouldn't solve it?

#

I'm not talking about default pawn spawn with game mode, I'm doing it custom by myself since I let players choose which character they want to play with

cobalt notch
#

No 'cos you can't just give it a controller, you'd have to possess it which again is what its doing anyways.

#

Just check this once you know its possessed.

upbeat basin
cobalt notch
#

Oh I misunderstood what you said.. It doesn't have a local controller, AI controller is not locally controlled.. that's what youre saying to check so that won't work.

upbeat basin
#

It's not giving an AI controller either, my auto possess is disabled

cobalt notch
#

Yeah so it doesn't have any controller than GetController should be nullptr

#

if it has a playercontrolller than islocallycontrolled will be working.

upbeat basin
#

Ahh okay I think I'm mixing IsLocallyControlled with HasLocalNetOwner

cobalt notch
#

IsLocallyControlled just means that you're controlling this with inputs using a playercontroller, that its possessed.

upbeat basin
#

Well apparently HasLocalNetOwner also relies on APawn::IsLocallyControlled so yeah I guess that's still a hard no to my question

#

Wait, actually no, it's relaying on IsLocallyControlled, if the owner is a Pawn, which in case of Pawn is wrong, since I'm asking setting the owner as the controller on spawn

cobalt notch
#

Maybe if you're using playerstart to spawn the pawn it should already be possessed by the playercontroller but I think its always unavailable on beginplay regardless. You may have to doublecheck this.

grizzled garnet
#

Specifically when does an actor begin replicating? On its first tick or before? I want to use some InitialOnly replication and have some initial setup during spawning before it's ready to replicate

chrome bay
#

At the end of the game frame

#

Whatever you do in the spawn frame will be picked up at the end of the frame

#

Tick will be too late potentially, depending on when it is spawned.

nova wasp
#

And of course on the client side

#

You should not expect any same-tick order

fallen fossil
#

Hi, if level has some actors that are not set to replicate. And new player joins game. will it spawn new actor for him or copy its values and then spawn?

I want to create quest manager for each player and do not replicate its values

kindred widget
fallen fossil
kindred widget
#

For starts, this is an actor placed inside the map, right?

fallen fossil
kindred widget
#

Then it will simply load up on that client with whatever values it has from the map.

fallen fossil
#

Ok, that also explains my second question ;d

heady copper
#

hello please i am having a hard time understanding that RPC table on the unrel documentation

#

any easier break down? the table is kinda confusing me for real

kindred widget
heady copper
kindred widget
#

On the server

#

To better phrase...

fallen fossil
# heady copper the table .....RPC invoked fromserver are RPCS sent from client to be executed o...

๐Ÿ‘จโ€๐Ÿซ My Patreon link:
https://www.patreon.com/kekdot
Download Project Files | Premium Tutorials | Courses

๐Ÿ•น๏ธ Get our Game on Steam | The Anomaly Project:
https://store.steampowered.com/app/2960770/The_Anomaly_Project/


๐Ÿง‘๐Ÿปโ€๐Ÿš€Get the project files here on Patreon: https://www.patreon.com/posts/66842088

In this video we take a look at the basi...

โ–ถ Play video
kindred widget
#
  • A client will make a Server RPC from an actor that the client owns that will run on the server IF the client owns the actor.
  • A server will make a Client RPC that will run on the owning client's machine of that actor.
heady copper
#

ill check the video

fallen fossil
#

thats is just what Authaer said. But maybe better explained.
Also multicast can be done only from server

heady copper
#

ohh ok thanks chief

kindred widget
#

Multicasts are also better avoided for the most part until you fully learn Replication.

heady copper
kindred widget
#

Not sure where the twice comes from.

fallen fossil
kindred widget
#

Multicasts run once for each machine the actor is relevant for.

Consider changing your armor color. If you multicast this. It will change for the current players in the game if they're close enough. If for any reason someone wasn't close enough and then they become close enough, they will not have the updated color. Similarly if a new player joins the game, they will also not have the color because neither of these received the RPC.

Replication on the other hand will always send most recent values when things change and when they become relevant so you replicate thus both players who did not initially receive the color will get the color at some point.

Multicasts are only really good for non state things. Like say you want to play a three second emote which you don't care if people out of relevancy see even if they get closer.

#

For this general reasoning, for a vast majority of gameplay systems, multicasts are largely useless over replication.

heady copper
kindred widget
#

๐Ÿคทโ€โ™‚๏ธ Probably somewhere in the depths of someone's blog.

woeful ferry
#

he has a multiplayer tip and tricks article

fallen fossil
#

How can I get pawn of current player / client locally, without replication ?

#

is that good?

#

can't get player controller, thats what I need ๐Ÿค”

lost inlet
#

on what

fallen fossil
#

on client side

#

so I get do stuff for each player independetly ๐Ÿ˜„

#

I get owner of local player state, and cast it to player controller. Now Im waiting for game to load up and stupid shaders ;d

lost inlet
#

that's not specific enough

#

what is the blueprint I'm looking at?

fallen fossil
#

actor blueprint

#

spawned on level, not owned by player

#

like what else do you wan?T

#

name? Its RingManager

#

?

pine tangle
#

wouldnt get player controller work? on client it should only include local controllers afaik

fallen fossil
ashen plume
#

Can anyone point me to resources on properly doing line traces in multiplayer

#

I understand backwards reconciliation but i dont know if its possible in bp

#

Like handling a synced clock, and storing positions at the same rate

#

And how cmc players interp will affect the accuracy

loud ginkgo
#

Hello! I am trying to disable replication on actors from certain clients, so I came across SetNetDormancy(DORM_DormantPartial). The problem is that my actor never goes dormant (even when setting to All). It gets marked as bPendingDormancy but ReadyForDormancy is always returning false because the actor constantly has replication changes. Has anyone else dealt with this? Are there any other ways I could achieve a similar thing?

// We need to keep replicating the Actor and its subobjects until none of them have
    // changes, and would otherwise go Dormant normally.
    if (!bIsInDormancyHysteresis)
    {
        for (auto MapIt = ReplicationMap.CreateIterator(); MapIt; ++MapIt)
        {
            if (!MapIt.Value()->ReadyForDormancy(suppressLogs))
            {
                return false;
            }
        }
    }
velvet current
#

Hi guys, I'm having a desync issue when calling through an anim notify. It's only intermittent. It only happens with the client, never the server. The server (screen on the right) always switches hands correctly, despite one of the clients seeing it incorrectly in this video. One vid is with break point on the AN to show it taking the wrong route. This method of syncing in the pic has worked for every other function so far so I don't know why this one is different. Please share any wisdom, I've been on this for like 6 hours today

#

furthermore once the error happens with my client, it breaks the animation graph and they're effective stuck in place

knotty bane
#

Can someone help me with this problem:

When one of the players enter a collision a sound plays, to turn it off you interact and the sound turns off. This all works but when either the server or client interacts the sound only turns off in server side not client, i use a multicast to turn it off, but same result with a rep notify

vapid gazelle
#

Am I correctly understanding that if I call a server RPC from the server, it intelligently resolves it to a local function call instead of actually making a networked call? I'm trying to interpret this response from the forums: https://forums.unrealengine.com/t/rpc-from-server-to-server/450525/2

Epic Developer Community Forums

Nothing that would cause a performance drop. The generated code (from the macros) makes sure you are calling the function where it belongs. So its just an aditional check. Obviously the easiest way is simply call a regular function if you are sure you are in the server and thats it, as long as you are sure the function will never be called from...

daring gorge
#

so this is an issue i face in/on client side where i set a reference to my anim bp by casting on begin play locally, however i dont know how/why it flushes out the variale completely, basically i check if this variable is valid on tick and it always returns invalid whenever i stay idle, it weird- ive checked the references all around and i cant figure out whats invalidating the variable, any ideas?

true karma
#

What could cause SpawnedVehicle to return None on all clients, but not server ( dedicated? )

The server is spawning an actor, stores it as a RepNotify variable, RepNotify calls a multicast RPC, but the replicated variable is None only on clients.

sinful tree
# true karma What could cause `SpawnedVehicle` to return `None` on all clients, but not serve...

If the multicast is called immediately after spawning the actor, then the actor reference may not be on the clients before the multicast is received. You also shouldn't be multicasting the set of the owner, it only needs to run on the server.

Clients also cannot call a multicast, so the OnRep doesn't actually call the multicast on the clients but it will fire on the server when you set the Spawned Vehicle value. Since the OnRep will fire on the server which calls the multicast immediately, the clients are receiving the multicast which is likely happening before the clients receive the actor reference.

daring gorge
sinful tree
daring gorge
#

this kinda makes me ask, do the animation bps work like widget classes where they work in respective to their own pawns?

sinful tree
#

Animation blueprints run locally and there is no replication in them. If you request to execute a montage it'll only execute locally. I believe these are the two types of things that are normally referenced as animations, and neither of them replicate themselves. In the example projects, any animations that appear replicated is actually happening because the animation details are replicated through the Character, and the animation blueprint usually pulls from that Character the details it needs to be able to run the animation locally, so really, there's no additional replication happening, it's just using replicated data to present what you want it to.

Widgets are similar in that there is no replication happening with them. They are created only locally, so if you wanted to have the widget contact the server in some way or have it use replicated data, it can't itself so you'd need to execute an RPC in a replicated actor to send the server information or read from a replicated actor the replicated data you want it to display.

daring gorge
#

right so it sounds exactly like a widget, you replicate the data and dont bother dealing with the animation part- all clients have their own sorta local copies of characters with their own anim bps on their local machines just pulling data for them from the server

#

if i got that right

sinful tree
#

The animation blueprints and widgets don't pull the data from the server. They use whatever local data is available that you're telling them to use, which could be replicated.

glacial moat
#

BP_ThirdPersonCharacter - This code only works for the "Server" and none of the "Clients" Does anyone know how to fix it?

dark parcel
glacial moat
dark parcel
#

It's not really two sets of code either

#

You decide what to run on what machine

#

In essence we all running our own instance of the game. The programmer job is to establish communication between each player instance to somewhat "sync" them to give illusion that we shared the same world.

glacial moat
dark parcel
#

You will end up with double component on the server

glacial moat
dark parcel
#

And try to avoid multicast for anything that should be in sync

#

In general don't use multicast until you know the basics imo

#

It's a common trap for people that just start

glacial moat
#

how do i get it to show up on all* 3 clients i have? (2 clients) + (1 server/client)

dark parcel
#

You can look at how to replicate variables via on rep

#

In general, you just set the variable in server, if marked as replicated, the server will update the client's value

#

If you are client, the only way to communicate to server is via server rpc

#

So if you want a client to change a variable, it needs to inform the server via server rpc, then the server will replicate it

#

Not doing so will only reflect the change locally

#

Read the pinned section on this channel

You will need to learn how to use switch had authority , is locally controlled, rpcs, rep notify, replicated variable and so on

glacial moat
#

rpc = ?

dark parcel
#

Check pinned sections, read them 8 times

#

Practice, fail, repeat

glacial moat
#

still looking for the others you mentioned so i can read up

#

Just now seeing pinned section , I read what you typed a few times

dark parcel
# glacial moat

I would assumed you have read them before using it here.

If you are looking at tutorials from youtube modt of them are bad or just plain wrong. Your best source of help is the pinned material, it will take time to click so take your time.

glacial moat
#

The first pinned message is a broken link

dark parcel
glacial moat
dark parcel
#

Once you finished that, practice with syncing something basic

#

Like a text variable on top of the player head

#

Their name or w.e

#

Then maybe opening/ closing door? For the next challenge

glacial moat
#

Will do, was just trying to do the basics with the static mesh that i showed too, but it was printing like 4 times XD. Again, thank you!

sullen sail
#

Why is that inside my onRep function of the "PistolHeld", only the authority role is being called? Should the onRep function be called to all the roles?

heady copper
storm bough
#

Anyone knows what entries similar to

LogPhysics: Warning: [Remote.Input] in fault. Reusing Inputcmd. (Client) Input: 37819. (Server) Local Frame: 90500
...```
 in logs mean?
Starts happening only on host when client joins and stops when client disconnects. Game seems to work normally, but this warning floods my logs now... unfortunately, I am not sure when this thing started happening. Uncle Google says nothing about it.
tardy fossil
#

Looks like it has something to do with the experimental physics prediction plug-in

storm bough
#

Hmmm... it is true I turned it on some time ago in vain hope ragdolls would appear same for all players (it did not). Will try to turn it off, thanks!

storm bough
queen escarp
#

?

glacial moat
#

I am still trying to wrap my head around RPCs can someone tell me if this is correct? (Works in Game) Just trying to make sure I understand it

cloud stirrup
#

If I was to get player uuid on server with no authentication method can it be spoofed or change at random? Or consistent throughout?

#

Just looking to get someone on an external website to verify a uuid or something to prove itโ€™s them as my normal sso wonโ€™t work anymore

grand mica
#

Just seen a very strange thing -
I was able to replicate a value in Character class without any server rpc but I can't do the same in Pawn class. Why?

dark edge
#

show your code

#

The game mode actor does not exist on clients

#

get game mode literally returns nothing

sinful tree
#

When you join into a game as a client, the Game Mode only exists on the server.

grand mica
#

one moment

#

my bad!
I forgot to add that it with DOREPLIFETIME

#

my bad

latent heart
#

With Mover, is it easy to modify the historical states? Let's say a client performs an action that affects location. It sends a timestamp to the server. The server wants to then effect that action in the past. Is it a simple task to update the historical values for Mover and resim?

thin stratus
#

But an NPP one

#

And no, I don't think so. NPP handles corrections on client side. Server doesn't even know what a correction is

latent heart
#

I see.

thin stratus
#

NPP has circular buffers of frames for all Models, at least in fixed tick. While you can potentially modify them, I don't think you can easily get the data to the client, especially not if it already reached it before, cause the client assumes all older packages were valid at that point

latent heart
#

That's a serious issue I feel

thin stratus
#

Idk what you are trying to do but we have yet to encounter a need for that

latent heart
#

Basically we have a resource, energy, which is tied to movement. But it's also usable by other things. So we wanted to handle energy consumption via mover/npp. But we also want to be able to accurately resim when those other things get used.

#

But it's not a problem if we can't resim, we will just delay I suppose.

#

As in, do it in the moment, not lag compensated.

thin stratus
#

Everything you want to Sim / Resim has to live in NPP land fwiw

latent heart
#

Yeah.

#

We already have the movement effects itself on NPP.

#

But not the resources (which isn't yet implemented).

thin stratus
#

Using Energy from outside NPP/Mover is probably not gonna work well

latent heart
#

That is my feeling.

thin stratus
#

I can guarantee you that it's not :P

latent heart
#

But we'll make it work.

thin stratus
#

NPP doesn't solve the problem that CMC + GAS gave

#

Movers latest commit have MovementModifiers built into Mover

#

Even a second simulation, like an NPP GAS, is gonna be shitty experience

nova wasp
thin stratus
#

ListenServer run other Services

nova wasp
#

Forgive me, I'm not aware of what Services are in this context

latent heart
#

Thanks for the feedback, Cedric!

nova wasp
#

I see IFixedInterpolateService etc

thin stratus
#

NPP is basically just a big Manager that has a multitude of Services, which are just some Class that have functions called on Tick.

#

And Models, e.g. Mover, register their instances based on the NetRole of the player, to those services

#

And those services are then allowed to access NPPs storage of frame data

#

That's kinda all it is

#

You can code whatever service you want

#

There are smoothing ones, tick ones, reconciling ones for corrections, etc.

#

You need to alter NPP for it though cause you gotta call the service functions in the NetworkPredictionWorldManager at whatever point makes sense for the service

#

Existing services can be overridden though by specifying the duplicated version of it with the specific model as templates parameter

#

Reflection magic

#

Each service basically has an array of registered instances which it loops over to call the functions then

#

AutonomousProxy uses a service that grabs input data and puts it into the frame data. ServerRPC service sends the data to the server.
LocalTick calls the predicted sim tick function on the driver (e.g. MoverComponent)

#

RemoteTick is the server version that ticks the client based on received input

#

Client locally is also in the reconcile service to check for differences and roll back

#

Ultimately NPP is simple af

#

At least structure wise

#

The code itself is a bit more complex due to tons and tons of templating

nova wasp
#

In my custom rollback setup I just do everything in a bunch of ECS for loops

The hard part for me was figuring out that you need to actually immediately store the rollbacked frame results

#

It's becoming a bit of a hairball as I have rendering data tied up in the rollback state (very silly)

fluid prawn
#

Looks like its an NPP party in here

nova wasp
#

Interpolation is quite simple but having a stable alpha per frame was fairly tedious to measure

thin stratus
#

We use NPP in fixed tick

#

Makes it rather simple

nova wasp
#

It does all this stuff for you thankfully...

#

I now run my entire game in a custom fixed tick

#

It has its downsides (technically input is delayed on non-simulating frames) but it's overall nice to know each tick is one unit (16.6ms in my case)

thin stratus
#

I mean NPP fixed tick is just a counter in the tick function that calls SimTick when the Ms are reached

fluid prawn
#

The current fixed tick is broken. It binds to the PostWorldTick Delegate and passes the FixedFrameRate value set in the engine ini even if its off

nova wasp
#

the math is quite simple but how you deal with it is another matter

fluid prawn
#

its annoying

nova wasp
#

you need to not accept insanely large frames, decide when to slow down the sim

thin stratus
#

Yeah NPP could improve that part too fwiw

#

Our fixed tick setup works fine for now

nova wasp
#

I doubt Epic has avoided dealing with that stuff I guess but it's just my take on making it from scratch

#

The GafferOnGames article is my main reference point

thin stratus
#

Probably also the only one properly explaining stuff

#

My main problem with NPP atm is the communication between NPP and non NPP, as well as one model with another, or even 2 instances of one model

#

Even in fixed tick it's flawed sadly

#

Cause Instances tick after another. They can't alter each other in the same frame. When one is done, it's output state is sort of sealed off

#

Suggestion would be to split the logic into SimTick and GatherOutputState, with maybe a Interpolate step in between

#

But I'm not in the mood to even further alter this damn plugin

fluid prawn
#

You're team is using it right? obvs a modified version of it

thin stratus
#

NPP 2.0 ๐Ÿฅฒ

fluid prawn
#

XD

#

I am learning it for fun right now

thin stratus
#

But yes, we are. But we had to alter it a lot to get it crash and bug free. Including Mover

fluid prawn
#

also learning alot about client prediction from it in the process

nova wasp
#

It's ultimately just re-doing things across the network

thin stratus
#

Learning from it is probably fine

nova wasp
#

the hard part is how to handle the many wacky situations

fluid prawn
#

I am making a little game project from it to learn

thin stratus
#

It's hard to find an implementation that is focused on just the generic prediction stuff

#

So in that regard it's a holy grail

nova wasp
#

At least the previous one had a generic ability that would make you dash

#

and stamina

#

which was a useful example I think

thin stratus
#

The problem overall, objectively, is that it and Mover are simply not done. They are lacking features, are untested, crashing, bugging, memory leaking etc.

fluid prawn
#

I do have one question about it

#

its more networking related

#

and game engine related in a sense

#

So I am just sorta mapping out the simulation steps between client and server with NPP. For the case of independent ticking, NetworkPredictionManager gets delta time from the engine frame. If I learned correctly when client or server runs seperate frame rates the tricky part is syncing their states. How are GFrames tagged across both server and client. I suspect that for uncapped simulation the Delta Time is accumulated and passed also to the server. The server just uses this to match what frame it has with what the client sent?

thin stratus
#

Just ping me on it, I'll check tomorrow. I'm falling asleep with my phone in my hand. It's past midnight in Germany

fluid prawn
#

another time

#

I will likely figure it out anyway

nova wasp
#

The engine static globals for ticks are more for the main thread

#

but I have no idea so don't take my word for it, I just made my own...

#

(which sucks and barely works lol)

fluid prawn
#

So when I looked at the Insights for Fixed Rate it was easier to see it. But for Independent You have Server GFrame and Client then under that is sliced up. For example when I was messing around with insights I noticed that at 120 fps I had 3 world ticks for one frame and then carry over to another frame.

#

This is where if I understand correctly is the Accumulated Delta time

#

now it gets interesting how to match what the Network Prediction ticked inside that GFrame and match it with the server that may run the simulation at a different speed

nova wasp
#

The multiple ticks could not just be the "stable fixed tick" but actually rollback re-simulations

fluid prawn
#

kinda trying to wrap my head around the ticking

nova wasp
#

For example in the worst case I need to re-do the frame like 10 times

fluid prawn
#

Taking a step back, in general for game engine ticking especially for uncapped stuff is there some frame budget behind the scenes that is defined to know when to carry over accumlated delta time?

#

or for uncapped its just simply accumlated over frames and subracted from over time

nova wasp
#

It depends? Some things will warn when they get extreme second+ deltas

#

With uncapped it just... goes?

fluid prawn
#

yea it would just go and always accumulate delta time

#

meaning it just gets added to and subtracted to over frames

nova wasp
#

With fixed ticking the idea is you add the real-time taken and "consume" the time when it accumulates enough

#

even multiple times if you need to do multiple frames in one go

fluid prawn
#

sub stepping

#

the accumluated stuff

#

i assume

#

so whats left is substepped

#

that frame

nova wasp
#

It's kind of like substepping for sure, where the amount of time is built up over time

#

And once you don't have enough time to eat to do one 16.6ms frame you go back to ticking as normal

#

and then eventually you have enough time built up to do another fixed tick

#

Making this 100% super stable is a bit of a doozy as in reality measuring time accurately with delta time is a bit wacky

#

You could for example actually use the CPU clock timer instead of the world delta time

fluid prawn
#

yeah

#

So for fixed ticking GFrame ticks at some uncapped frame rate say 120, the network simulation code runs at 30 hz so we would run sims every 4 frame after a X amount of sims we package that shit up and send it to the server

#

server gets the data with the GFrame It got and delta times and compares with its own Simulation

nova wasp
#

but effectively... sometimes yes

#

The idea with this stuff in the RTS-style ideal case (lockstep rollback) is to only send the player inputs at X frame

#

but I don't know what NPP sends

#

When one side gets a new input that is different from their assumed input that frame you must go back in time and redo everything in that sort of parallel reality

#

One interesting property is that DELAYING the state locally (input delayed, show a technically older frame visually)

lets you get away with less mispredictions

#

so most fighting games will start with 2-3 frames of input delay baked in because it allows them to have a larger buffer of ~33ms where they can wait for both player's inputs to arrive

#

which means less need to rollback!

#

Which is not just for visual smoothness, but also because rollbacks can cause violent jittering between states that are hard to react to

#

Like "oh actually I was punching 3 frames ago... try to block now"

#

But once again this is all in the theoretical sense... the NPP could work differently entirely for all I know

fluid prawn
nova wasp
#

yes, it's not counting up frames it's counting up time elapsed

fluid prawn
#

or built up?

nova wasp
#

built up

#

The good news is that the NPP + async physics do this for you

fluid prawn
#

very cool

#

So I did read that bad boy a long time ago

#

I remember that after reading that, Unreal CMC was using a clamp type

#

where like

#

if you had say 60 hz and your running at anything higher it would just treat stuff as 60 hz anything below would be substepped

nova wasp
#

Unreal CMC substeps

#

This is with 0 input delay and 120ms ping (my custom setup)

Because it takes 120ms for the input to reach the server (network emulation)... you are perpetually quite behind

#

each time they jitter forwards is the entire game redoing 8 frames and showing the result inside of one frame

#

This is somewhat similar to how CMC jitter looks unsmoothed

#

but it's far worse because we force the state to be "show me what actually happened on frame 123424" and we don't just show delayed results

fluid prawn
#

so basically if your shit takes to long to get to the server and the server is ahead

#

you're f'd

#

so you get corrected?

#

so when you get some acknowledgement from the server I guess based on your ping you can sorta know how many simulation steps to need to be ahead for the next round trip

#

or something

nova wasp
#

there is no correction, there is just where people end up after we rollback

fluid prawn
#

ah

nova wasp
#

I currently force clients to catch up a bit with the server but the exact frame timing is probably a bit iffy :/

fluid prawn
#

haha

#

The magic of network programming

true karma
#

is there some kind of documentation for knowing which functions automatically replicate to all clients when run on the server ( like SpawnActorFromClass ? ) there is nothing on the node indicating that it does so.

sinful tree
# true karma is there some kind of documentation for knowing which functions automatically re...

Spawn actor from class doesn't replicate anything. You define on the actor whether it replicates or not and if you spawn an actor marked as replicated, then it would get replicated out to clients.
There is no documentation that would list all functions that provide some kind of replication as the functions themselves don't really replicate - it's typically a variable being set that ends up replicated.

true karma
#

gottchhaa. makes sense. thanks again!

void moth
#

Hello, all! I'm working in UE multiplayer for the first time, though I have experience in other engines and non-game network design experience. I've got a sandbox scene that's basically working, except for two things:

  1. I can't figure out how to inform each PlayerController of their own player index in the overall world. I just want to assign a default player name for testing, and I thought it would be trivial to just get their network session index and call them Player 0, Player 1, and so on. The engine clearly has this data, because it titles the player viewports when I run PIE.

  2. My pawns both move locally in response to input driven from the PlayerController (I'm using DefaultPawn and not Character because I don't need or want a skeletal mesh). But neither player's camera is seeing movement of the other pawn's visual mesh. Obviously the pawns are replicated, their movement is replicated, and I enabled component replication on the visual mesh. I could use replicated events or RPCs or something along those lines, but is that the most efficient way to do this?

Thanks, and sorry these are n00b questions. I'm not new to network programming, just new to doing this in Unreal. ๐Ÿ™‚

#

Config info for the preceding questions: My GameMode is a child class of GameMode, my Pawn is a subclass of DefaultPawn, my PlayerState is a subclass of PlayerState, and my PlayerController is a subclass of PlayerController. I don't have a Level Blueprint here.

sinful tree
# void moth Hello, all! I'm working in UE multiplayer for the first time, though I have expe...

Don't bother with trying to reference players by any kind of index. It makes it extremely difficult to manage.
Player Controllers are spawned when a player joins a game. The PlayerController has a reference to the PlayerState and their Controlled Pawn/Character. The Pawn/Character has a reference to the PlayerState on all machines, and to its controller on the owning client and the server. The PlayerState has a reference to the PlayerController it belongs to and can get a reference to the pawn the player is controlling as well, but isn't always valid on all clients unlike the playerstate which is.

#

Through any of these common classes you should be able to reference which particular player you care about.

#

The GameState also has an array of all the PlayerStates in the game, so if you ever need to do something with all the players currently in the game, that's how you can get some reference to all of them.

#

Replicating movement is more complex than just ticking replicate movement and then moving them on the client. Unless you have a custom movement component that RPCs some details about the pawn moving, any movement you may be doing on the client would not occur on the server to then replicate to everyone else.

The character movement component normally does most of this for you whne you're using a "Character" as you'd "Add Movement Input" and that is what ends up triggering an RPC to the server to handle the replication of the movement.

void moth
void moth
# sinful tree Don't bother with trying to reference players by any kind of index. It makes it...

Understood. For one thing, the exact order when they join is unpredictable, and if a low-numbered player loses their network and has to reconnect, the indices become broken unless I'm really careful to resync...et cetera. ๐Ÿ™‚ I'm not planning to use this method for real development -- I just thought it would be an easy way to tell which client was which for early prototyping. Maybe the right answer is to just let the server-side PlayerController generate a random hexadecimal string. I don't care what the names are, just that they're different in the logs. ๐Ÿ™‚

#

The application here isn't a "game" in the sense of any kind of match or level. I'm building a mixed reality app for a non-game engineering situation, and there is really only one "player" who will have the handheld or HMD mixed reality. The "server" (which will be a ListenServer even for actual usage) exists as an extension of the mobile device. (Ideally, the mobile would actually be the ListenServer, but that just doesn't seem smart in terms of performance.) The bad news is that I have to replicate a lot of data, but the good news is it's guaranteed to all be on a private LAN at gigabit speed.

torpid lantern
#

I am managing "sitting" as a state, which is an enum on the player unit.

  • Player unit runs over to camp fire and sits down, state is set to "sitting"
  • Montage plays for observers (multi-cast?)
  • Intended: Late joiner enters relevancy and observes player unit sitting (looping last frame of montage)

I am stuck on the last item. How do I tell late joiner to pick it up from the last frame of the montage? If I use OnRep then the whole montage will play, but if I MC then late joiner will see player unit as standing by the fire.

torpid lantern
#

I've got GAS, should I instead look at gameplay cues?

void moth
plucky prawn
#

is there a way to do a multicast but exclude a specific player or set of players? i want to make it so when i shoot a weapon the shooter will play their own sound and animations and the server will multicast the event to play the sound and effects

sinful tree