#multiplayer

1 messages · Page 232 of 1

oak night
#

I expect the server to add 1 to player numbers and send that back to the client.

fossil spoke
#

PlayerNumbers is 0 -> Left Click -> RPC to Server -> PlayerNumbers + 1 -> RPC to Client -> PlayerNumbers is 1

#

Thats exactly what its doing

oak night
#

No, its updating the value from the client, not the server.

fossil spoke
#

Huh?

oak night
#

Its only showing it on the server

#

Yeah im so confused.

fossil spoke
#

Did you want PlayerNumbers to increment each time you Left Clicked?

oak night
#

Yes, the increment should happen on the server only.

fossil spoke
#

Ok, thats whats happening...

#

What part makes you think that it isnt?

oak night
#

Let me show you some more images.
It makes it more clear.

#

My spawn event, which should increment the number on the server, then after thats done i get the number in the Player number on server variable. (i get them from the retreive players function.)

#

First image

#

Just spawned on server.

#

Increments correct.

#

Spawned second set from client (right side).
Number increments again from 0 (server prints run on server string so i asume server is updating)

fossil spoke
#

Ok

oak night
#

The numbers for the client should have been 10

#

11

#

12

#

etc

fossil spoke
#

Right

#

So because you have all of this functionality in the Pawn

#

And each Player gets their own Pawn

#

They each get their own version of this functionality.

#

So when a second Pawn comes into the picture

#

The PlayerNumbers variable for the Pawn on Client 1, is a different PlayerNumbers variable to the one on the Pawn on Client 2

#

Does that make sense?

#

Because PlayerNumbers is "local" to the Pawn, as you put it earlier

oak night
#

Yes, thats what im seeying

fossil spoke
#

Do you understand why thats a problem?

oak night
#

But i expect when using run on server, that it only does it for host pawn, and send to client pawn.

fossil spoke
#

No

#

Thats not how that works

#

The Server has the same separation of Pawns

oak night
fossil spoke
#

If we have 2 Clients

#

Each Client will have their Pawn

#

Right?

#

That makes sense?

oak night
#

So host and client, each a pawn (in my mind) is actually 2 pawns for host, 2 pawns for client?

fossil spoke
#

Each Player will have 2 Pawns in their World, since they need one for themselves and another for the other Player.

#

Therefore

#

The Host (server) has 2 Pawns

#

And the connected Client has 2 Pawns

#

So therefore, 2 versions of that code running

#

Which is why you see that result

#

Since you can only send RPCs to the Actor

#

There must be the same version of that Actor on the connection you are sending the RPC

#

Otherwise the RPC fails

#

Since its going no where

oak night
#

I understand up until this point.
(Since you can only send RPCs to the Actor
There must be the same version of that Actor on the connection you are sending the RPC)

fossil spoke
#

Yes

#

If you want to count the number of Players

#

And you want that count to be singular for everyone

#

That count must exist only once

#

So you need to store it somewhere that exists only once

#

Since there can be multiple Pawns

#

That is not a smart choice

#

This type of thing is better handled by the GameState

#

Since the GameState is a singular Actor that exists once

oak night
#

That is good to know.

#

I tried this in gamestate earlyer which did not work (probably my error), which made me switch to using the cameractor pwan for this.

fossil spoke
#

Hopefully this doesnt further confuse you, but this image should help you to understand.

oak night
#

Well still there is one thing i dont understand.
At least the picture is not clear.
Let me grab paint and draw a image.

#

Which one is true?
1 or 2

fossil spoke
#

Technically the second one.

#

But its better to think of it from the first lol

#

In multiplayer there a number of things that provide context to why thats the case.

#

Network Role is one.

#

ROLE_Authority is given to an Actor that is directly spawned by that context, if it wasnt spawned due to replication.

#

This is typically true of all Actors on the Server.

#

With a few exceptions

#

When a Pawn is created

#

For the Local Player

oak night
#

This is the picture of what i expect.

fossil spoke
#

That Pawn will have the Network Role of ROLE_AutonomousProxy.

#

ROLE_AutonomousProxy indicates that Actor is locally controlled by that Player.

oak night
fossil spoke
#

Yes

#

This is more accurate

#

This shows that the RPCs are being called on the Actors themselves

oak night
#

So thats why its getting its own variable

fossil spoke
#

The RPC is not being called in a "global" sense for the Server or for the Client

oak night
#

Mindblown

fossil spoke
#

They are called in relation to the Actor that they exist on

oak night
#

Ok i will draw one more picture, then i think you can make me understand what to do next.

#

Using the some actor as a buffer to do the run on server locic on?

fossil spoke
#

Sure, that SomeActor would just be the GameState

#

As I mentioned earlier.

oak night
#

In my mind there needs to be a placeholder for the variable i want to increment.

#

I will try for a moment.

fossil spoke
#

The PlayerCount variable would be on the GameState

#

You would also have the RetrievePlayerCount RPC on the GameState

#

The CheckPlayers RPC would need to be in the Pawn still, or the PlayerState, or PlayerController.

#

Since Server RPCs need to have whats called a NetOwningConnection.

#

Which is provided by the PlayerController

#

And anything owned by the PlayerController on the Client will inherit the NetOwningConnection.

#

Pawns and PlayerStates are by default owned by the PlayerController.

oak night
#

So the playercontroller acts as the tunneling pipeline

fossil spoke
#

Its your connection to the Server

oak night
#

I have things setup in the player state.
But when i try to get the player state from the player controller, it always fails.
Hence i cant reach the player state to call the event from the client.

#

This picture is in the CameraActor Pawn

fossil spoke
#

Be careful with that.

#

PlayerControllers dont exist in the same way Pawns do.

#

Using GetPlayerController like that can produce unexpected results.

#

Since you are in the Pawn, you should be using the GetController function

oak night
#

Oh wow i did not even know that existed đŸ€Ł

#

It keeps failing

fossil spoke
#

Oh, yeah the Pawn has access to the PlayerState as well

#

Its a property of the Pawn

#

No need to use the PlayerController.

oak night
#

Really lol

#

Still failing when i used that.
It only shows a succes message on the server for all 3 gamestates

#

Leads me to believe the gamestates only exist on server?

fossil spoke
#

Huh?

#

I thought you said those images were for the Pawn?

oak night
#

Yes

#

they are

fossil spoke
#

So what are you talking about the GameState for?

oak night
#

Sorry player state i mean

fossil spoke
#

Can you SS the code you have right now?

oak night
#

Part 1: Inside player state

#

Part 2: Inside pawn

#

Part 3: in pawn

#

So use pawn left mouse click to increment number through player state, to have server return number back to client.

fossil spoke
#

Why are you using the PlayerState, I thought I made it clear that the GameState needs to manage this?

oak night
#

Oh damnit

#

Im sorry man

#

Its been a long day trying to make this work

fossil spoke
#

The Pawn can have the CheckPlayers RPC that goes to the Server.

#

Which then increments the GameState::PlayerCount variable

oak night
#

Ok, i will try that, tomorrow with fresh eyes and mind.

#

Thanks for the help so far Matt, i learned more from you this past hour then many tutorials.

fossil spoke
#

No problem.

#

Good luck.

oak night
#

This works like a charm, so i should see the gamestate as the gameinstance of the server i guess.
The pawn is now using the rtc to update it in the gamestate, and the client receives the update.

One question left, in this scenario, is the pawn actually "asking" the server from the client, or from the pawn existing on the server?

#

Ok time for bed 😉

fossil spoke
#

The Client Pawn is asking the Servers version of that Pawn

crisp shard
#

to customize a newly controlled pawn's visual (i.e. it's camera) would i just be able to add a spring arm/camera to it like any other pawn and it will work based on that ? currently just defualts to a fp view, but i also dont have any camera on this pawn currenlty

forest knot
#

Hey, I have a problem that my network object (inventory item) getting removed after player character dies (even tho I loot the item, and change its outer).

  • On client, local player kills another player, loot his item into his own inventory, but when died character de-spawn item marked as garbage collected.
  • Same scenario on Server, everything works just fine.
  • On client, If I drop the item, cause to spawn a object, then pickup item back (creates a new item), then it not garbage collected.

here I posted in forum as well, with more explanation + video: https://forums.unrealengine.com/t/network-object-inventory-item-removed-after-player-removed-even-tho-looted/2268750

My first time working Unreal Multiplayer, any idea would be appreciated.

haughty ingot
forest knot
#

Sure,

From CellWidget's OnDrop:

    //TODO: Bundle operation in one rpc
            InventoryComponent->ServerRemoveItem(ItemDragOperation->FromCell, ItemDragOperation->Item);
            InventoryComponent->ServerAddItem(Cell, ItemDragOperation->Item, DragTopLeftPosition.X,
                                              DragTopLeftPosition.Y);

ServerRemoveItem called in InventoryComponent:

void UInventoryComponent::ServerRemoveItem_Implementation(URepCell* GridWrapper, UItem* Item)
{
    GridWrapper->RemoveItem(Item);

    UE_LOG(LogInventory, Display, TEXT("[SERVER] Removed item %s"), *GetNameSafe(Item));
}

and ServerAddItem:

void UInventoryComponent::ServerAddItem_Implementation(URepCell* Cell, UItem* Item, const int32 X, const int32 Y)
{
    if (Cell->TryAddItem(Item, X, Y))
    {
        UE_LOG(LogInventory, Display, TEXT("[SERVER] Added item %s to at (%d, %d)"), *GetNameSafe(Item), X, Y);
    }
}

So when client opens external inventory (i.e., a death body), it loads the replicated representation of the data, create widgets dynamically. Then when drag-drop Item, it simply apply ServerRemoveItem and ServerAddItem.

Structure of classes:
Character->InventoryComponent->Inventory->Cell->Item

#

God in discord all code formating looks nightmare

haughty ingot
#

So your replicated object items are kept in replicated object slots?

forest knot
#

Yes all chain from InventoryComponent to Item are replicated UOBjects

#

InventoryComponent is UComponent

haughty ingot
#

Can you show me remove item and try add item in your cell

#

Or grid wrapper, you’re calling it two different things in the functions but I assume it’s the same thing lol

forest knot
#

Btw, Cell not directly contain the items, it uses FastArray of FItemPlacement. But I believe there should be no replication issue, because except this issue, I have no replication problem yet

haughty ingot
#

Are you using the replicated subobject list, or the old way of object replication

forest knot
#

Ah I'm not sure on that

haughty ingot
#

Where are you constructing a UItem, something isn’t making sense

#

You can replicate the structure, but the objects inside won’t replicate if they aren’t net addressable and added to some form of subobject replication

forest knot
#

Items created from a factory method,

#

I'm sorry to fill the all page with images, I guess I designed this system with so much classes and it seems hard to describe the high-level overview of it

haughty ingot
#

No it’s fine it’s the only way I can read on mobile

forest knot
forest knot
haughty ingot
#

How are you replicating the UItem?

#

Or URepCell? What is a rep cell anyhow, the slot?

forest knot
#

All Uobjects that replicated has this kind of setup

haughty ingot
#

Yeah, but that doesn’t replicate the object

forest knot
haughty ingot
#

It’s just saying it’s supported for replication

#

There we go

forest knot
#

and from inventory component I replicate subobjects

haughty ingot
#

You’re doing it the old way

forest knot
#

oh really

#

I even didn't know there is a new way

haughty ingot
#

Not specifically going to solve your issue, although I suspect it will because it looks like you’re removing the item and it’s becoming unreachable before you’ve added it to something else. I bet if you run GC every frame currently you’ll find the issue

forest knot
#

God, I struggled to understand this old way replication, and cause tons of errors. I guess there is really value to come and ask people

haughty ingot
#

The new way is as simple as adding the object to an actors replicated subobject list, and removing it when it’s destroyed.

#

Both client and server should maintain their own replicated subobject lists

forest knot
haughty ingot
#

The best way to solve GC problems is to run GC every frame

forest knot
forest knot
haughty ingot
#

Yeah, it’s gc. Something. I forget off the top of my head but if you type “everyframe” I’m sure it’ll come up

forest knot
#

I mean I felt more like, even though I tried to set the owner of the Item it still keep belonging to the death player, or maybe owner is not replicatied properly which cause, whenever player removed, also bring the item with him

haughty ingot
#

I saw you were talking about the outer but remember GC doesn’t go that way.

#

All “rename” does is change the objects internal name and outer, but it won’t keep it alive

#

Something else needs to hold a pointer to it to keep it alive (or strong pointers but that’s not really a good use case here)

forest knot
#

Or do you think, problem is not related the owner but more like some dangling pointer somewhere

haughty ingot
#

I mean changing the outer is fine, but you still need the new thing to keep it alive

#

Also try to use TObjectPtr for member variables instead of raw pointers. It’s what UE wants now

forest knot
#

Ah, I understand now, I even thought that when player removed it forces to remove the item with him together, but I guess I assumed wrong because GC only works when there are no reference anymore?

haughty ingot
#

GC will run through and flag it as unreachable even if it’s still valid. Then actually free the memory on the next cycle. That’s why it’s important to use IsValid(object) in most cases because it checks reachability. Not just if the pointer is pointing to valid memory

forest knot
#

Then, let me optimzie the code with TObjectPtr's and new way of replicating subobjects. Maybe it will fix the problem

#

At least it will open some fresh space in code

#

Thanks a lot for all suggestions!

forest knot
#

Tried both but sadly not worked

#

Though, got a short video that shows when garbage collection triggered, what are the outters for the objects.

#

Note that, I have not set outters here, but when I set I seen that they are not replicated (i.e., if server set it to inventorycomponent, it will stay transient for client)

twin juniper
#

In a scenario where I have a lot of items (can vary from 10 to 100 and even further in rare cases) in a fast array inventory, would it be sane (and faster ?) to put my items in a tmap (ItemGuid / ItemInstance) once replicated locally and make my find methods iterate through the map directly ?

forest knot
#

I'm not so sure but I guess it should be depend on the implementation. FastArray limits the representation of the data much, so It may block some replication in your structure

#

And how you planning to access the items?

little pumice
haughty ingot
#

a stale pointer is not valid memory.

little pumice
#

yeah though it's UB, e.g. memory can be deleted and then reallocated but in completely different context

haughty ingot
#

You really aren’t going to have many issues with stale pointers with UObjects if you’ve handled them correctly. I think in this context using “valid memory” is fine when it comes to something as high level as dealing with Unreal’s objects.

Same reason why in Blueprint it’s called “Is Valid”, and not “Is Not Null and Doesn’t have GC flags”. Because there really isn’t a need to be pedantic at this high level unreal

haughty ingot
little pumice
honest bloom
#

The way you explained it .. made me realize much more simply what lag compensation is
You kinda connected the dots for me
Thx !

dark parcel
honest bloom
twin juniper
ruby tundra
#

Hi, Guys. I need some help. I want to know how can I check the latency between the server and client. and then on the basis of that either pause the game or kill the server.

Can any one provide me with a solution or guidence.

dark parcel
#

Iirc

#

You can also ping manually or get round trip time

#

Simply doing an rpc and calculating the time from sending the letter to getting the answer

ruby tundra
#

any built in function that i can use or is it a third party plugin

dark parcel
#

I just mention the node to get the ping.

ruby tundra
#

oooh

ruby tundra
ruby tundra
#

hehehe

#

that was uncalled for

dark parcel
#

Or connect to server that is in your local region

dark parcel
ruby tundra
#

but the internet is 300mbs per second

ruby tundra
dark parcel
#

What are you pinging

ruby tundra
#

hehehe

#

the cmd is saying 30ms but unreal is saying 303

#

and the server i am using is playfab

#

so i am confused

dark parcel
#

Make sure your server region is your local region

oak night
oak night
dark parcel
#

What does game state as the game instance of the server even mean

#

Game state is game state, game state is replicated to everyone.

Game instance on the other hand is not replicated and every machine have their own GI

oak night
dark parcel
#

I still don't understand

oak night
#

Im very new to unreals way of doing multiplayer, as im used to photon cloud.
So the concepts are very different and important to understand correctly.

dark parcel
#

it's just 2 completly different objects with different purpose and different life time

chrome bay
#

GameState is primarily for replicating match-specific information

oak night
chrome bay
#

I.e, team scores, time remaining etc.

#

Those sorts of things

oak night
dark parcel
#

That's got nothing to do with multiplayer or not though

upbeat basin
#

I feel like WizardCell's persistent data compendium link is the answer here

#

But I'm not aware of the inital question so it's just a guess

chrome bay
oak night
dark parcel
#

in a case of server travel is the game state even presist?"

#

what is actually preserved other than the actors that is added to a list

upbeat basin
chrome bay
#

It supports seamless travel yeah, assuming you are going to a gamemode using the same GS

oak night
#

My "original" question yesterday was about how to have a client pawn ask the server to update a single variable only existing on the server.
And that variable apparently needed to exist in the game state.
Matt helped me with that and it worked.

So im not looking for information across levels.
I simply made a refference to a concept, eventho incorrect it did help me understand the role of the gamestate.

#

Thanks guys for jumping on it, really nice support here đŸ„ł

lament flax
#

Is PIE local multiplayer instances only running on PC or on the LAN network ?

#

Like i test stuff in PIE, can a co worker login by mistake ?

tardy fossil
#

like you are running a multiplayer test in PIE and then your coworker on the same network starts up their own multiplayer PIE and it joins yours instead?

#

dont think that can happen since it connects to localhost and not an ip or anything

upbeat basin
lament flax
upbeat basin
#

But if you want to do it to test stuff, I think it was possible but I'm not sure if it can be done on PIE as well or just standalone only

lament flax
#

okay thanks for the insights

sinful tree
teal frost
vapid gazelle
#

Is it possible to use the CMC on Actors that aren't just a humanoid player running around the map?

For example, can I throw the CMC on a bouncy ball (with no controller attached to it) and take advantage of its replication, reconciliation, smoothing and all of the other useful functionality it comes with, even though my bouncy ball wouldn't be a character?

Or is this nuts and not how the component works at all?

haughty ingot
#

That’s partly that Mover 2.0 was aiming to solve

vapid gazelle
chrome bay
vapid gazelle
chrome bay
#

All CMC does for smoothing is blends the mesh to the capsule over time, that's all you have to do

#

Capsule location is always hard-set

#

mesh interpolates to it each tick

#

Snaps if the distance is too large

#

very trivial stuff

meager heart
#

I keep having issues with Reliable Multicast RPCs not being called on my clients

My latest example is on my gamestate, where when a player's score is changed it fires an event on the server (it's already on the server at that point but it's just for clarity), which calls a multicast, but that multicast is never received by the client game states. Am I doing something wrong with multicast?

And I also know it's not the reliable buffer because I've debugged that and I only have a handful of RPCs firing at this time. I would bet though that if I added a delay before it calls the multicast it would work, for some reason when my player death event is firing it seems like all of my multicasts don't work

vagrant jasper
#

Hey does anyone know what could cause the players from not dealing damage to each other? I have added the tag properly, and all the nodes where I can select Run on server are setup that way, but my print strings are still not saying anything is being done to the other player.

exotic wasp
#

dedicated server with 2 clients or listen server?

#

my guess is that you're trying to call a server rpc on something you have no ownership of

half falcon
vagrant jasper
#

repnotify?

exotic wasp
meager heart
meager heart
# exotic wasp use a OnRep/rep notify

so for something like this, on rep notify doesn't fire when an internal array value gets changed (afaik), so if I wanted to force a rep notify would I just have a bool that gets flipped or something? That feels a bit janky

half falcon
# vagrant jasper repnotify?

Could someone help me with this?
The goal is to make the player place a bomb > ignore the bomb collision while he's on it > re-enable when he leaves the area.
It's working on the listenserver side, but the client acts like they're colliding, and keeps teleporting the player actor around the bomb.

I'm using "IgnoreComponentWhenMove", it's being executed by server authority, I don't know if the collision ignore is being replicated (Note that I checked "replicate" for both bomb and player collisors)

exotic wasp
meager heart
#

Hm okay I thought I tested that but maybe there was some other interference, let me check. Thanks for the info though

exotic wasp
#

bp is really limiting for multiplayer

grand kestrel
#

That sounds like I'm telling you that, just in general I mean 😄

forest knot
#

Hey, I have a replication problem, related the inventory system.

  1. on client, local player kills other player
  2. local player take other player's item
  3. after other player de-spawn, item marked as garbage in local player's inventory.

I explained it more detailly in here: https://forums.unrealengine.com/t/network-object-inventory-item-removed-after-player-removed-even-tho-looted/2268750

My question is, highlighted with red at the end of the diagram ("why no replication?").

What are the suggestions about this problem? Because I'm not sure if I'm looking to correct place

grand kestrel
#

Sounds like the other player is still the owner of that item and responsible for it's replication as a result

forest knot
#

That also sounds like the most logical thing, however I couldn't find a way to change the owner. Even though I set the outer with Rename(nullptr, NewInventoryComponent)

haughty ingot
forest knot
#

I also tried the new system as you mentioned and I got lots of ideas from it. However I tried but still didn't worked, this may because of I couldn't implemented it well to current system. Because I already have lots of logic and haven't planned the replication it to be this way.

#

So it's possible that I missed some part, in adding and removing. But simply adding items into replication list, and removing them anytime I remove the item, also didn't solve sadly

exotic wasp
forest knot
haughty ingot
#

Sounds weird

forest knot
#

😅

haughty ingot
#

It sounds more like you just have some architectural flaws more than anything, because it really is as simple as removing and adding it from the list. Just make that happens at the correct time and the correct order.

forest knot
exotic wasp
#

you don't need to use iris

#

are you using uobjects for items?

#

if so, is it a member of an actor or components replicated subobject list at all times?

haughty ingot
exotic wasp
#

ah

prisma merlin
#

Placed actor on world is not replicating, help.
It only works if you use the Spawn Actor by server during the game, but if the actor is already in the world, nothing happens.

half falcon
crisp shard
#

im trying to fire a line trace based on the camera of a newly controlled pawn, and it seems that the server doesn't have access to the camera location / rotation, or maybe there's another aspect of this newly created pawn that isn't using what my character is (im just attemtpting similar logic to the char, getting camera location and rotation to start a line trace). but i know that the pawn doesn't have a movement component (i dont think this should matter, but perhaps it does?).

#

on client the trace follows camera but server trace is just in whatever the camera's starting position is. i have a "look" input setup, but again, not sure if this is really doing anything to cahnge camera location as i dont have any movement component or anything like the char does, but curious why this doesn't work the same way (unless it is from not having a movement component)

hearty kite
#

I'm spawning apples and bananas on trees near each other in a listen server multiplayer. My player has an overlapping component using a collision channel for interactables. If I swap out (scale to zero, or remove component from ID) an instanced static mesh component and place an interactable actor in its place using overlapped sphere component from the player, and I walk away from the blueprint interactable items, I'm having a hard time respawning the PCG Instanced Static mesh in place of the blueprint. How do I relate the ISMComponent with the BP_Interactable to a Client from the Server? Client does not see Servers ISM Component and vice versa as they re not replicable

dark edge
#

What's this trace for?

crisp shard
dark edge
#

If the camera orientation is driven by control rotation the server will automagically end up with the same rotation eventually, but the best feeling approach would be to tell the server the thing and have it do a sanity check if necessary

crisp shard
#

makes sense that it doesn't, would i just be able to send the camera location from the client then ?

dark edge
#

what's driving camera rotation right now?

crisp shard
dark edge
#

is it like:

Input -> modify cam rotation?

#

or:
Input -> modify control rotation
Cam is opted in to use control rotation

crisp shard
#

this is my current look input

dark edge
#

ok thats modifying control rotation

#

do you manually do anything to the camera or do you let the Use Control Rotation thing handle it?

crisp shard
#

i may too many boxes checked, as i was testing a few things, this is in my camera

#

i also have this :

dark edge
#

been a while since I messed with this stuff but you might be saying:
"Use control rotation, then just use the inherited rotation from your attach parent"
which is clobbering it

#

I suppose first off, print control rotation on tick, make sure the server and client agree on it. I think it's automagically synced through controller but don't really recall

crisp shard
hearty kite
#

How do you replicate InstancedStaticMesh components? As they are non replicable.

crisp shard
#

should i be using "use pawn control rotation" ? also, it's on both the spring arm and the camera , i have both checked

rustic sable
# hearty kite How do you replicate InstancedStaticMesh components? As they are non replicable.

you mean like in PCG or another usecase? just have them spawn on both server and client and replicate the indices. I have them on both when an overlap occurs I have this just happen on the server an call a HISMOverp function. First spawn a replacement depending on what the component was. The replacment gets a reference to the ISM component and index. Basically if the replacement is a tree or rock it has a box collider, on end overlap if there's no players in the collider I restore the ISM by the index. (with a short timer) if someone re-enters the timer cancels. Don't actually delete the instances this causes a mess in the arrays and problems when someone logs back in, just offset them off screen, I use an offset of 10K, subtract it out when 'removing' the instance then add it when you want to restore is. The remove and restore is just multicast. Also don't replicate transforms, they 96 bytes each. I even have a lookup for the ISM components on both client and server so it's just a int32, not really as big a deal here but still.

edit: if the breakable that is spawned is destroyed mined, cutdown wtv then I send the ISM component and index to a function in my manager. (its position is already offset because of the overlap) It gets a timestamp here and gets put into a restore array. Every few minutes a function can run on a repeating timer that checks this array and restores the position if they meet the global respawn time (1 hour or wtv).

dark parcel
crisp shard
dark parcel
#

I don't know what else to say, that's the straightest way to get the control rotation

#

Control rotation = where the player is looking at

crisp shard
dark parcel
#

Perhaps you are mixing it with something else

crisp shard
crisp shard
dark parcel
#

Yeah how you print it

crisp shard
dark parcel
#

And the result

crisp shard
#

never changes

#

stays at whatever it starts at

dark parcel
#

Show

crisp shard
#

on server*

dark parcel
#

Well did you move the mouse around on both of the computer?

dark parcel
#

Just make sure you move the look view on both server and the client

#

Test in pie, move your mouse around for server

#

Go to client window move your mouse around

#

Their base aim rotation should not be default by then

#

Do that and show the print string result

crisp shard
#

im confused a bit, the print will show the client resutl changing as you move and server value is whatever it started at. that is what you will see, but i also don't understand what testing on a server would do for me

#

im assuming it is something in my control rotation settings

#

i also added a camera

#

and that also has settings, which i messed w trying to figure out what to chang e

dark parcel
#

I scrolled up

#

Camera transform is not replicated at least by default

#

And what's the point of wasting bandwidth anyway

#

If you want line trace from the camera. And the camera never get relative offset.

You can just use the control rotation ( get base aim rotation for proxies ) to get the direction where the player is looking at.

#

Then just line trace from camera location to the direction of where the player is looking at.

#

On the other note why do you need to do line trace both on the client and server? They shouldn't have the same values especially if the character is moving. There is delay.

You should just let local controller trace and use that as the truth for easy mode.

crisp shard
#

these would be what you're suggesting to use ?

crisp shard
#

only can look around

#

it's not a char, more so a turret i suppose

dark parcel
#

So why do client have to trace?

crisp shard
#

i was simply just making a simple line trace test

#

made a clinet and server version , just to see, and found the server was not getting values

#

but yea i could just send client location / rotation stright into the RPC i guess

dark parcel
#

Is the turret the player?

crisp shard
#

but i'd rather just figure out what the issue is, as i dont have this issue w any other logic which is based on a similar concept

crisp shard
dark parcel
#

Then what is this server client even about then?

#

Assuming the turret is A.I

#

What kind of data does the server needs to know from anybody?

crisp shard
#

ohhh you mean, is the turret Controlled by the player ?

#

yes*

dark parcel
#

Is it possessed by the player?

crisp shard
#

yes

dark parcel
#

Then get base aim rotation will work

#

It's already replicated

#

And rpc already fired to server if client

#

Get base aim rotation = the control rotation

crisp shard
#

testing rn just to see (again im thinking i have at least 1 setting wrong here, but testing rn)

crisp shard
#

the server line trace alwasy goes to same spot

#

client's goes as expected

rustic sable
#

without reading the lore sounds like smth that should be replicating from the server is only happening on the client. Is the actor replicated, are its components set to replicate etc

modest crater
#

ForceNetUpdate is pointless on a character right since its update rate is so high? Just confirming

crisp shard
#

The camera component is not replicated tho no. Not even sure I could do that. There are a few other ways to get a result I’d like but it is a bit confusing why the rotation doesn’t seem to be read on the server

quiet yarrow
#

Trying to do this while factoring in potential desync. Any ways to do this without building a tool? Something simular to how collision checks are made when you spawn an actor?

rustic sable
# crisp shard The camera component is not replicated tho no. Not even sure I could do that. ...

if you're getting a rotation from a local camera it won't be on the server.
On the client, the PlayerController manages the camera's location and orientation the server has a representation of the PlayerController for managing server-side logic. There's yt tuts on how to replicate the camera if you really need to. I think I was doing smth like this for my aiming logic but would have to look at it again.

crisp shard
rustic sable
#

without knowing the goal here base aim is the direction you are aiming. not the direction the capsule or mesh is facing

crisp shard
crisp shard
errant charm
#

Does GameState persist during ServerTravel to a new level? Or is it only GameInstance?

teal frost
modern plank
#

Can anyone help explain what I'm doing wrong? I'm working on a multiplayer game. Currently, I have an "interact" mechanic that does a line trace and from there it checks if the hit actor implements an Interface and if it does, it executes that interface on that actor.

  1. The line trace executes at the server
  2. The interface execution connects to a custom event on the actor, and the custom event is multicast.

The issue I'm having is that when the line trace executes, it doesn't recognize the player's pitch. So the trace for clients is happening is a horizontal line from the player, instead of the ground or ceiling or wherever the player is actually looking.

#

Just answered my own question, sorry. Had to include the line trace start and end locations in the event execution so that the server has the start and end locations for execution.

hearty kite
rustic sable
hearty kite
#

so it's one ISM component ... uh oh

hearty kite
hoary timber
#

hey, so I'm not looking for any solution, but rather if approach I'm thinking to take is ok or I'm missing something. Here's some context
I'm making a first person coop puzzle game. All the player interaction is processed through the server, so Client calls Server version of Interact function, it gets processed there, and whatever happens in then sent back to the client.

Now, I'm trying to include a minigame, which is a small simple strategy game, with which a player can interact, but in this case, a lot of stuff can be processed on the clients side - like selecting a unit, or determining which action that unit takes, and only if the player decides what to do, then communicate that to the server.

My issue is that since I'm controlling the player character, and everything happens through a player character, is including a local version of interact function a good idea, or should I try to do something else?

#

so local version of the function chooses a unit, and it's action, and then that's get processed on the server

oak night
#

Lets say i have 1 map, with a lobby widget for hosting and joining.
Can i then keep everyone who joins on this map?
Or as the host do i "Need" to travel to a different map with the "?listen" first.

My prefference is to do it all without needing to travel to a different map.

rustic sable
# hearty kite so it's one ISM component ... uh oh

yeah idk about that. On Overlap I get the static mesh from the component -> get name, then that name I use as a lookup for the row in datable for the replacements. I don't see how pooling would be beneficial here. đŸ€”

grave lynx
#

after a server travel, player controller is not reset. Is there a function to override to reset some values? Or I need to home made something?

rustic sable
thin stratus
#

Hard Travel is probably a bad idea.

dark parcel
#

I thought the idea was once the game started and clients joined. Use server travel.

Hard travel should only occur when hosting the game or when joining for the first time.

thin stratus
#

You are right about the second part, but that's still only a suggestion.

#

ServerTravel can be HardTravel or SeamlessTravel.

#

HardTravel: Clients get disconnected and actively reconnect.
SeamlessTravel: Clients get parked on the Transition Map.

#

Steam, for example, is very unhappy about Hard-ServerTravel

#

But if one would ignore that case, you can totally do every Travel as a HardTravel.

#

Epic just advices not to, probably mostly cause it's nicer for the Player.

rustic sable
#

I have a game where the player needs to click a point indicated on a slider. I was passing the click to the server but latency can cause missed clicks here. If I was checking on the client how can I validated something like this before triggering a success?

thin stratus
#

Like, you'd do it locally, tell the Server what the Client clicked, and the Server will then check if that makes sense given the Client's Ping.

#

At least if I understand correctly what you are trying to do.

#

"click on a point indicated on a slider" is not that clear to me.

#

Like, is this a timed event? Does the Slider move up and down and they have to click at the exact moment the Slider is on top of the point?

rustic sable
#

yeah, just a timing game. a hammer goes back and forth on a slider, click when its above a certain point

thin stratus
#

Yeah, Server and Client would basically need to both know about a given "Start" timestamp when the Hammer started moving. And then Client then tells the Server when it clicked, with a timestamp that uses the same "system".

#

Then the Server can take that timestamp to validate if the Hammer would be on top of the Slider for example.

#

A synced Timestamp like this can be figured out via a sync clock that should have a pinned post in this channel.

rustic sable
#

ok fair enough, thanks, I'll take a look.

thin stratus
#

It might actually not even need the Client to tell the Server a Timestamp tbh

rustic sable
#

yeah, I mean if the clocks are in sync then just send and account for latency maybe

thin stratus
#

If you can ensure the Hammer is started with the same Timestamp (relatively), then the Server can just take its own time and subtract the Ping time.

#

Yeah

#

+- some threshold

dark parcel
#

Article is great, I got a working network clock from copy pasting what the article did.

But I was also told there's already one in player state.

Just need to increase the update frequency on the player state for more accurate clock.

#

Or just make your own, I think the one in article is more involved and accurate.

vapid gazelle
#

Does replication typically stop firing once the actor is in the process of being destroyed?

thin stratus
dark parcel
grizzled stirrup
#

If you have multiple UPROPERTY bools in a struct that is replicating, does unreal automatically pack them into a uint8? I heard something in #cpp that they do, or should I be doing something like this myself instead?

    UPROPERTY()
    uint8 bSomeCoolBool : 1;

    UPROPERTY()
    uint8 bAnotherCoolBool : 1;

    UPROPERTY()
    uint8 bYetAnotherCoolBool : 1;

I'm on 4.27 if that matters

dark edge
#

server can do a sanity check, like if you're close enough, then process

nova wasp
#

replication converts things into a stream of bits

#

it does not care about alignment etc... it will depend on the type

#

3 bools only need 3 bits of information as much as 3 uint8 bits

#

you can try out the network insights window to see how your replication stuff gets packed

grand kestrel
#

@thin stratus @pallid mesa I'm including this branch, for teaching purposes
I've also found it useful for narrowing down issues with complex movement implementations
Its the same as USprintMovement in the main branch but using move containers instead of compressed flags
https://github.com/Vaei/PredictedMovement/tree/sprint_containers

pallid mesa
#

hi vaei that looks useful, thanks :)

pallid mesa
#

very nice

hearty kite
fiery wadi
#

Can someone tell me if OnComponentHit is automatically replicated please? I ask because Im having a weird issue 😄

#

This works fine as in the health bar goes down on both Server and Client and when the enemy dies it plays the death effect to both Server and Client

#

but this function which applys a DoT to the enemy and then kills it works "ok"ish as in the server can kill and deplete the enemy hp and it all works across the network but the client does not update the enemy heatlh bar at all but can kill the boxes on their local machine but the server doesnt know the enemys are dead.

#

Do I have to run a "local" version of this as well as "Server" version of this which both have to be called when a client kills an enemy with a DoT?

#

Am not quite understanding why OnComponentHit which essentially is doing the same as the DoT function but in "instant" damage works fine but the DoT damage function does not work in the same way.

dark parcel
#

The only way for client to communicate with server is through server rpc.

#

Setting variables on client, replicated or not will only set it for it self.

fiery wadi
#

So why does my Client communicate with the Server in the OnComponentHit work?

dark parcel
#

The same when you destroy a replicated actor as a client. Only the client copy will be destroyed.

#

The on component hit likely just happend in both of the machine.

#

Imagine a box collision

#

Server have the box collision, so does the client.

#

And the code is just saying if you step on it, print string.

#

So when a something overlap with the box collision on a machine something will print.

fiery wadi
dark parcel
#

You have to understand that everyone is running their own instance of the game.

#

Each machine is running their own code.

#

I didn't watch the video but looking at the codes it's already incorrect.

#

Damage and death is server only.

fiery wadi
#

So why does it work if either a client or the server kills a box?

dark parcel
#

What works? I explained above

#

If a client set a value it will just change the value for it self.

#

If a client destroy a replicated actor it will destroy the copy in its instance only.

#

You should decide on who does what.

#

Atm it's a mess, a lot of machines doing the same logic.

fiery wadi
#

The first 2 boxes one is destroyed by Server which updates the client, and the 2nd box is destroyed by Client which also updated the servers instance

dark parcel
#

Read above

#

You got no filter

#

On component hit will trigger on server when ever the component is hit on server.

The same thing on component hit will trigger on client when the component is hit on client world.

fiery wadi
#

ok and IF client destroys a box should that update the server?

dark parcel
#

I explained twice already, no

#

If client destroy a replicated actor it will only destroy its own copy.

fiery wadi
#

Thats what I would expect to happen but for some reason it,s working.

#

Which is why i am confused.

dark parcel
#

Explains 3 times

#

That the component hit is happend in every instance of the game.

fiery wadi
#

Ok.

#

So the OnComponentHit basically auto replicates to the server , Correct?

#

which is why everything after OnComponentHit works as Multiplayer Functionality.

dark parcel
#

No this has nothing to do with replication

#

Absolutely nothing to do with networking

#

You write the logic as such if a component is hit , run X

#

Picture 3 players, everyone running their own instance, running their own world.

fiery wadi
#

Yep

dark parcel
#

When player 1 hit component trigger then it trigger on his machine.

#

When player 2 hit component trigger then it trigger on its machine.

#

And so on

fiery wadi
#

Yes and each would only run on it,s local machine correct?

dark parcel
#

Yes

fiery wadi
#

without a call to the server to say "Hey, I hit an enemy"

dark parcel
#

You need to write your logic first on paper. Decide who does what.

#

Like a goal post.

#

You don't care if the client overlap it.

#

You only care if the overlap happend on server

fiery wadi
#

So with this Basically P1 should not be able to half damage an enemy which is located on the servers instance right?

dark parcel
#

In which you can do by switch has authority.

dark parcel
fiery wadi
#

Thats what i thought too!

#

Ok box takes 10 hits I fired 6 on Client and then 4 on Server at the same box and it destroyed the box with the above code , Which does not seem right to me

dark parcel
#

Yup totally expected

fiery wadi
#

Ok im dumb

#

lol

dark parcel
#

One way to do this or shooting game in general

#

You can have the client tell the server, hey I hit something

#

Then server apply the damage

#

You just replicate what you need, such as hit points

fiery wadi
#

Yep did you look at the little vid btw?

#

Thanks for the advice btw 🙂

#

Ahh this info I just found might be something "Delegates are not replicated. Executing delegate from server, on clients it’s bit tricky, need some forethought and invovles writing quite a bit of supporting code. All data you will try to send trough delegate, will need to be replicated. DOREPLIFETIME or other macro, depending on how you want 
" (The event of Set Timer By Event Nodes are Delegates).

sinful tree
#

If the event that starts your timer is "Execute On All" then it is a multicast, which means you're starting the timer on all machines that receive the multicast. So each machine is then running a timer and then executing the events of the timer individually based on whatever values they have at the time the timer triggers.

fiery wadi
#

Ye i think I need to have a NonReplicated function which triggers a Multicast to tell all the connected clients inc the server to run the Timer Node and apply the Damage Over Time to the enemy gonna take some tweaking about and I,m sure eventually it,ll click at some point but I think at the moment I,m kind of using the Trial by error method until my brain goes "Aha!"

#

Or a Non Replicated -> which requests a Connected ServerRPC to start the timer something like this. xD

sinful tree
#

Actually, you shouldn't be using a multicast for something like this at all... Health should be a replicated property on the target actor, and set as a W/Notify ... This then gives you a function that adjusts when the value changes. The server should be the only one actually applying any damage.

fiery wadi
#

I understand "Switch Has Authority" has 2 lines of logic one will tell the server what to do and the other will tell the connected clients what to do

sinful tree
#

The timer only needs to exist on the server, the server sets the replicated health property, clients receive the OnRep and can adjust whatever visual things you want with the new value.

fiery wadi
#

Ye thats actually a better method 🙂 I need to learn to use RepNotify more as well

#

Thank you.

dark edge
#

that switch does no communication, it's a way to branch the code differently whether the object is authoritative or not. A replicated actor will be authoritative on the server, and not on clients.

rugged oasis
#

how to pass my player camera manager to the server?

#

but the server doesn't see my camera manager

dark edge
#

what are you actually trying to do

rustic sable
gritty nebula
#

hello everyone, does anyone know for steam am i able to set the game map in steam lobbies or do i have to use steam sessions for that

thin stratus
thin stratus
gritty nebula
# thin stratus Remind me what the difference is again.

gotta be honest im not 100% sure. i read online lobbies supposed to be for groups to get together beofre game begins and sessions are for finding each other like in a game browser. right now im under the impression that two different clients connecting and existing in one level is different than lobbies and sessions but idk

hearty kite
# rustic sable yeah I get that part but not sure how pooling would help with the spawned actors...

Pooling has been more stable than spawning/destroying many actors quickly in my experience in this case. There are six to eight apples per tree with lots of trees, and multiple players, not including foliage, berries and other types of interactables littered throughout the world. It's just a lot, so since I was getting crashes earlier from spawning and destroying so often I decided to pool and haven't looked back. No crashes. It's cool because I'm only pooling the BP_interactable base class and changing their look based on a PCG tag 'apples', 'bananas' etc from the looped static mesh spawner PCG node

thin stratus
#

You can create, find, join and leave a session without ever connecting to a server in theory.

#

The default join session node just does the connecting part for you, but in terms of code it's an extra step.

#

You can also connect to a server without sessions.

#

Sessions hold information about the server, e.g. the address, to make it easier for players to find and join a server.

#

They are mainly a blob of information in a database

#

Now lobby vs game (or Steam might call them Party vs Game) sessions are just a way for steam to group them in case you want to search for either of them separately.

#

On Unreal Engine's end, if you want to have the "light connection" for parties and groups of people without actively traveling to a map, you'd be looking at "Beacons".

#

C++ required

#

Most people here will early on create a session with the default nodes and that will create a "Game" session. And then use the Join Session node to join the session and get passively connected to whatever server that session is from.

#

Anything more advanced needs plugins and/or c++

gritty nebula
grand kestrel
# thin stratus Nice, thanks. Also good work on the wiki. I'll read through it when I find some ...

I have almost completed my modifier implementation, which includes buffs/debuffs, both internally activated (activate on self) and externally activated (applied by another character on server only), as well as partial client authority to prevent de-sync when applied externally. I just have one remaining issue but its really bizarre so haven't been able to get past it yet 😐 It desyncs if you modify Velocity from the OnStartModifier() function, but only if FPS is >=61, never if <=60 😄

thin stratus
#

60 FPS is the threshold for a feature in the CMC.

grand kestrel
#

😼

#

My assumption was that something was overwriting it following replication

#

But.. yeah, that wouldn't explain the threshold

thin stratus
#

So

#

It's been a while, so I might be slightly wrong, but:

#

ClientNetSendMoveDeltaTime=0.0166

#

That's a GameNetworkManager variable.

#

It's used in UCharacterMovementComponent::GetClientNetSendDeltaTime

#

Which gets called in UCharacterMovementComponent::ReplicateMoveToServer

#
        if (bCanDelayMove && ClientData->PendingMove.IsValid() == false)
        {
            // Decide whether to hold off on move
            const float NetMoveDeltaSeconds = FMath::Clamp(GetClientNetSendDeltaTime(PC, ClientData, NewMovePtr), 1.f/120.f, 1.f/5.f);
            const float SecondsSinceLastMoveSent = MyWorld->GetRealTimeSeconds() - ClientData->ClientUpdateRealTime;

            if (SecondsSinceLastMoveSent < NetMoveDeltaSeconds)
            {
                // Delay sending this move.
                ClientData->PendingMove = NewMovePtr;
                return;
            }
        }
#

In other words, if the Client has a framerate that causes the SecondsSinceLastMoveSent to be less than NetMoveDeltaSeconds, it will not send the Move and put it into the PendingMove variable.

#

NetMoveDeltaSeconds most likely ends up being 0.0166, which is 1/60

grand kestrel
#

Do you have UDN access btw, can I link something for you

thin stratus
#

With 1/61 you go below that number and the PendingMove stuff kicks in.

#

Due to that, you'll get into the Combine Move logic next time.

#

If your Movement starts breaking with >= 61 frames, then you aren't handling move combining properly.

#

You can test that by disabling Move Combining via Console Variable.

#

p.NetEnableMoveCombining

thin stratus
grand kestrel
#

Hmm that's true, I'm not doing anything in CanCombineWith for these yet, I was for Snare but.. yeah, didn't add it 😐

#

I'll test

#

I found something labelled "Listen server don't ack clients movement if clients FPS is too high" and it sounds similar

thin stratus
#

The thing that is important to note here is that a Combined Move is not actually replacing the initial Move.

#

What will happen is that it will perform the Move A, and then try to combine it with Move B (the Pending Move)

#

Which means if it manages to Combine, you need to undo Move A.

grand kestrel
thin stratus
#

There is a function in the SavedMove called "SetInitialPosition" or so

#

For the longest time you might have wondered what that is for compared to the outer function to setup the Move

#

That's where you save the initial value that will change throughout your Move

#

E.g. the Stamina value.

#

When you combine 2 moves, you'll want to reset the Stamina back to the Initial Value of Move A

#

It's super annoying that this isn't really explained properly.

grand kestrel
#

Gosh, this is all it took to fix it

thin stratus
#

Yeah, but if you later have a move that canb e combined, you'll still need to understand it

#

Sprinting Forward in a Straight line can be combined.

#

But the Stamina has to be handled then.

grand kestrel
#

So, if you imagine Boost and SlowFall work similar to sprint in their implementation, and ignore Snare, would this be correct?

thin stratus
#

Yeah.

#

Combining a Move is only a thing, again, if you can replace 2 individual moves with 1 and its results in the exact same state.

#

As soon as the result would be different if one of the two has a property different, then that property is meant to be checked in the CanCombine to block the combining.

grand kestrel
#

Ahh yup

#

I need to update my wiki on move containers then

thin stratus
#

E.g. Sprinting in Move A and Move B can be replaced by sprinting in the Combined Move C.

#

But if you Sprint in Move A and not in Move B, that doesn't work, cause Combined Move C doesn't know that it only sprinted partially.

#

Now if you do sprint in a straight line through Move A and B, you gotta handle that Move A can be Pending and Move B will be processed before being combined withe Move A. And then Combine Move C will be processed.
Which will result in Move B being processed twice, consuming more Stamina than you expect.
That's what the InitialPosition (state) is for, to save the Stamina and properly reset it back to before Move B.

#

Idk if I can explain this clearly. It makes a lot of sense once you fought that problem once.

#

And it#s really annoying since <= 60 FPS you might not notice :D

grand kestrel
#

@thin stratus thanks so much as always, I just learned something pretty immense now 🙂

#

Totally just made those functions click

#

Going to do my best to translate them for PredictedMovement wiki

#

@thin stratus Does this look correct?

thin stratus
#

Yes and no.

#

The Pending Move is older.

#

Let me double check once more

grand kestrel
#

I've added a bit more, but haven't corrected for that yet

// We combine moves for the purpose of reducing the number of moves sent to the server, especially when exceeding
// 60 fps (by default, see ClientNetSendMoveDeltaTime).
// By combining moves, we can send fewer moves, but still have the same outcome.

// We can only combine moves if the values are identical, otherwise we need to undo the first move before applying
// the pending move. This is because the first move is applied and then the pending move is combined with it.
// When combining moves, the initial move is applied and then the pending move is combined with it
// So we need to undo the initial move first, by resetting the initial move to the value we provide here,
// which we simply retrieve from the CMC.
// Afterward, the pending move will be applied, and the correct result will be used.
thin stratus
#

Right so it works like this:

Inside ::ReplicateMoveToServer

  • Check if we have a valid PendingMove
    • If yes, check if we can combine the NewMove with the PendingMove
      • If yes, combine NewMove with PendingMove and set PendingMove to null
      • If not, continue
    • If not, continue
  • Perform NewMove locally
  • Check if we have a valid PendingMove
    • If yes, continue (can't override)
    • If not, check if we should delay sending the NewMode
      • If yes, set PendingMove = NewMove and return
      • If not, continue
  • Send Move to the Server
    • Here we can send up to 3 different Moves:
      • OldMove
      • PendingMove
      • NewMove

Not too sure about the OldMove right now, but also not interesting for the combining.

The point is though that if there is no PendingMove yet, it will set NewMove as PendingMove and not send it (in the >= 61 FPS case).
It did, however, already process that move locally. Next time it enters the function it will check if it can combine the PendingMove with the next NewMove. If it can combine it will and then process that combined move. But now the PendingMove will be processed again as part of the combined move.

#
// We can only combine moves if they will result in the same state as if both moves were processed individually.
// When combining moves, the PendingMove is passed into the NewMove.
// Locally, before sending a Move to the Server, the AutonomousProxy Client will already have processed the currently PendingMove (it's only pending for being sent, not processed).
// Since combining will happen before processing a move, PendingMove might end up being processed twice.
// Once last frame, and once as part of the new combined move.
// To counter that, we need to make sure to reset the state of the CMC back to the "InitialPosition" (state) it had before the PendingMove got processed.
#

@grand kestrel Something like that.

#

Gonna leave it at that for now. Have to take care of a few thing at home now (: good luck

grand kestrel
#

Thanks so much! I'll dig into it 🙂

grand kestrel
#

@thin stratus Thanks to you I completed the final stage of my generic modifier implementation
Includes (stacking) buffs, debuffs, self-activated, target-activated on server, and multiple levels of each rather than on/off, and client authority for target-activated up to a specified distance/etc.
Once I complete the wiki and I've tested it more I'll do a proper announce 🙂
If you wanna preview you can checkout the modifier branch https://github.com/Vaei/PredictedMovement/tree/modifiers
@pallid mesa

grand kestrel
#

Ooh somewhere when refactoring how modifiers work I broke my snares 🙂
So not done yet 😛

thin stratus
lament flax
#

@thin stratus @grand kestrel in case you didn't already knew about it you might be interested in https://docs.google.com/document/d/1UO6Ww6Lfpti3YElVdo9uioTUtQJQ9CoSLvd9kF8hvJo/edit?usp=sharing

nova wasp
thin stratus
hearty kite
tall drum
#

Hello

I would like to understand something about cheating. The setup is Listen-Server and here is the context:
I have a mouse input linetrace that I execute on client then re-execute on server. for preventing cheating. So, I am using a LineTraceSingleByChannel() and using DeprojectMousePositionToWorld for the FVectors

The thing is, for client (not the one hosting the server), I cannot verify this linetrace on server because, the mouse position is only client-side

My plan is to make the vectors replicated and pass it to the server (With RPC or juste replicate var).

But my question is, by doing that way allow the client cheating with the hitResult from the linetrace, am right?

nova wasp
oak night
#

Guys, even with replication turned of for my chaos vehicle it still creates a copy on the client.
Ideas on what happening?

nova wasp
#

one could easily spoof the packet if they were willing to

lament cloak
#

Might be running on the client

oak night
#

Already checked, its not printing on the client, so its not spawning the car that way.

lament cloak
#

Oh, well that's annoying

tall drum
oak night
#

Yeah i have no clue whats left to check

nova wasp
#

to see if it was from replication inside of chaos vehicle stuff etc or just something else

oak night
oak night
#

I even removed the whole garage on the client, which takes care of the spawning.
Still the car popped up, so it must be that the car still replicates even with everything turned off.
So weird.

nova wasp
#

I guess this is a good example of why c++ is a bit necessary for mp projects sometimes... I suppose you could try to see if bp exposes the event stack to be printed

#

Also I would recommend getting in editor multiplayer working if possible as it can be useful to be able to see things working quickly even if it's not a perfect recreation of real two separate clients

odd hamlet
#

Does anyone have an idea on why doesnt the client also travel to the new map?
only the server manages to travel there, but the client doesnt 😩

lament flax
odd hamlet
#

if i want to test my multiplayer game which contains a lobby system, is it better to test it via Standalone game?

lament flax
#

yes to be 100% sure it works

#

for eg with EOS you cannot really test in PIE

kindred widget
#

Depends though.

lament flax
#

depends also if you use seamless travel or not

odd hamlet
#

i am using

kindred widget
#

You don't really need an OSS for 90% of it besides the name systems and double checking connectivity through their systems.

#

And Steam for example will not allow you to have two clients on the same machine so you're going to be testing a cooked game anyhow.

#

But before you need to finalize that last little bit, the majority can still be done in PIE through the Null subsystem.

thin stratus
#

I mean the seamless travel from lobby to gameplay level doesn't need any OSS

#

Does need standalone though cause of the seamless travel

#

Or you can try your luck with pie seamless travel

kindred widget
#

Seamless travel đŸ€ź

thin stratus
#

Necessary evil

quiet yarrow
flint epoch
#

Hello, I was wondering if someone can help me with something inside the CMC. So I have many mechanics that use the jump input. jump, mantle. hang and others. that the character tries to do them when jumping. Now the thing is all these are checked once the character jumps. however, i want that the jump should remain the same, but the other mechanics should start checking conditions after the input has been pressed for 0.2 seconds.

I tried modifying the first if statement of this with get controller and GetInputKeyDownTime (I know this is not the way to do it since it is a multiplayer online game but I was just testing)

// Try Mantle
if (MultiCharacterOwner->bPressedMultiJump)
{
    SLOG("Trying Multijump")
        if (TryMantle())
        {
            MultiCharacterOwner->StopJumping();
        }
        else if (TryHang())
        {

            MultiCharacterOwner->StopJumping();
        }
        else
        {
            SLOG("Failed Mantle, Reverting to jump")
                MultiCharacterOwner->bPressedMultiJump = false;
            CharacterOwner->bPressedJump = true;
            CharacterOwner->CheckJumpInput(DeltaSeconds);
            bOrientRotationToMovement = false;

        }

}

This is inside the void UMulti_CharacterMovementComponent::UpdateCharacterStateBeforeMovement(float DeltaSeconds) btw.

But it just makes it so I can only jump after I press for 0.2 which is basically the same as original but worse. Any idea where should I implement this functionality I want and properly?

twin juniper
lament flax
#

on GM logout, why is the PS duplicated in AddInactivePlayer ?

mighty yoke
#

hi guys I'm probably missing something obvious
I would like to have clients have their save files locally
When they join a session they pass the save data to the server so the server knows all the info it needs to load up their character
But when I tried it like this the save data is empty
How do I pass along a client's save data to the server?

kindred widget
# quiet yarrow whats wrong with seamless?

Generally speaking, not much. Nothing that good project structure can't fix. But it's one of those things that quickly gets messed up. Loading screens during it hitch during it from world loading, or from people sync loading things, which is a huge problem on consoles where clients are connected and still talking in voice because you have to keep their voice indicators visible and active and that is hard to do with slate frozen. On top of that there are issues with actors sometimes persisting despite that they shouldn't. And for the actors that do persist for the data transfer like playerstates and such, they drag stuff from the previous level into the new one, which can bring a lot of referenced data if you're not careful with linkers.

Just a lot of minor stuff like that which shouldn't be a problem, but tends to be and it's annoying to deal with sometimes because the fixes are rarely small.

kindred widget
mighty yoke
#

I can use C++ if it's required for this

kindred widget
# mighty yoke I can use C++ if it's required for this

In BP if all of your data is in a single struct in that savegame, then you can just pass the struct itself. Or you can manually pass every single data item from the savegame.

If you want something more generic, and can use C++, there is a serialize function that can write an object down into a simple byte array which you could send.

And then either way you'd have to construct a new savegame(not load), on the server and set the data in it either from the loose properties or reserializing the data into the new object.

mighty yoke
#

Oh I didn't realize pointers were a special case thank you I think I can work around this understanding that

nova wasp
#

for things like asset pointers and replicated objects unreal kind of magically does this for you and hides the complexity

kindred widget
#

It's just a name list.

#

Mostly anyhow. At least to replicated objects you pass a pointer to an actor component and it sends like... WorldName.SomeActorName.ComponentName And then it just finds them by that path name.

nova wasp
umbral geode
#

hello guys, I work with unreal for some time, but I'm really noob with multiplayer and replication, and I'm trying to fix a small problem on a project here.
Basically, the game is a shooter, where you can buy weapons when you die.
all the respawn logic is already made on game mode, so what I did is:
I created an array var on PlayerState (BoughtWeapons)
When the player buy one weapon on the Widget, I just cast to the PlayerState and add the BoughtWeapon to the array.
On the respawn logic, I just get the BoughtWeapons and add the needed weapons to the spawned character.

The problem that I'm facing is:
It's working pretty well on server, but not on the clients.
I know that GameMode only runs on server, but I don't know exactly the correct way to solve this.

dark parcel
#

The client can send a server rpc that adds the item to the array in the player state

#

Seems to me your issue is you are adding it on client.

The only way to communicate to server from client is through server rpc.

Setting anything on your own machine as client will only sets it locally.

#

Replication works from server to client

leaden bone
#

Is it me or the CMC doesn't replay jumps in case of desync? Like in FSavedMove::SetMoveFor we save the value of bPressedJump but in FSavedMove::PrepMoveFor we ignore it

#

Didn't tested in game yet, but it looks like the input will be ignore during replay?

hearty kite
tacit furnace
#

hi i got problem with this code Run On Server not working on client it's an actor i have another actors with similar code but only its not working (componentReplicates Replicate movement etc. is open) and I use this https://www.youtube.com/watch?v=4vUCXwOMXsY&t=1354s https://blueprintue.com/blueprint/jwgps0ki/

Support me here: https://www.patreon.com/halbotstudios
Get my assets here: https://www.fab.com/sellers/HALbot Studios
Join the Discord and showoff your work here: https://discord.gg/Syccf4gTwE

Learn how to create a Resident Evil-inspired power switch puzzle in Unreal Engine 5! In this step-by-step tutorial, we'll replicate the iconic power sw...

▶ Play video
hoary timber
tacit furnace
#

but if I set server event client cant interact with switch but multi cast can interact dont sync with server

thin stratus
#

@tacit furnace Is the Actor/Component you call the RPC on owned by the given Client?

#

Also.. is that a Singleplayer tutorial?

#

That will be really tricky to convert to multiplayer on the fly.

#

You can't just call RPCs in the Switch Actor. You would need to set up your whole interaction system to be multiplayer ready.

tacit furnace
tacit furnace
thin stratus
#

There is no "fix". You gotta convert whatever they are doing to Multiplayer

#

That requires knowledge of how Multiplayer works.

#

Your interaction system that toggles the switch already has to have the multiplayer part built in, so that your RPCs are sent in a client-owned actor

#

Which means you can't flip the switch like this in the Actor. You have to RPC wherever you do the interaction code that traces for the switch (or however that works in this tutorial). And then tell the Actor to flip the Switch via RepNotify booleans etc.

#

Doesn't make sense to me that you follow that tutorial if you don't know the basics of multiplayer yet. Better learn from a multiplayer tutorial and then make that little switch thing yourself later.

tacit furnace
#

Okey bro thanks

dark parcel
#

At least the one I sees on youtube

true stream
#

actors marked as replicated, if their movement is not replicated, and I move them on each client, does that mean they might get out of sync?

upbeat basin
#

What does it mean and why? Is it getting out of the net cull distance and not being relevant by server anymore, although client seeing like they are in range? Or is there more depth to it?

rustic sable
subtle cliff
#

Hello, everyone, I am working on an RTS game that should have many characters. Currently, the issue is with CMC and the character itself. I tried to write an efficient movement component for a pawn, and it was successful but does not have network prediction. I am looking for a lightweight solution plugin that is very lightweight and enables me to use it for a large number of characters in a multiplayer RTS game while having the network prediction on client sides.

chrome bay
#

If it's an RTS I'm not sure why you'd need prediction

#

I'm also fairly certain said plugin doesn't exist.

#

In fact, for an RTS, you almost definitely don't want prediction

thin stratus
#

Yeah, the only other partially non-sane thing that people do is have actual P2P for RTS, but that's not a thing for UE anyway.

subtle cliff
subtle cliff
chrome bay
#

How many characters are you moving here? You should literally just be able to move them on the Server and they will "smoothly" blend on clients.

subtle cliff
#

When I used another movement ocmponent, all simulated proxies movemetn become very choppy

chrome bay
#

No chance lol, not with CMC

subtle cliff
#

yes its not possible with CMC I am asure of it 😂

chrome bay
#

1K will be choppy because you won't be getting nearly enough updates to do smooth movement, so they'll be snapping

#

You will need a more bespoke solution

subtle cliff
#

no the 1k example was not cmc

#

it was a custom movement comp and fps was fine

#

it was choppy only on clinets

chrome bay
#

Well 1K of any actor, CMC or not, will be biblically too expensive to replicate movement

#

So you'll need something more bespoke

#

Replicating the movement of 100 sim proxies (which don't even run CMC anyway) is a hard task on it's own

subtle cliff
#

well so far I test 300 it was fine

#

with cmc

chrome bay
#

At those kinds of counts, even using AActor can be brought into question

#

it was probably fine in editor, but IRL probably won't be great

subtle cliff
#

it was not editor it was on two different pcs

#

and bottle neck was skeletal mehses. which I am switching them to Vertex Animations

#

So the thing is it might be 1000 actors, ,but not all of them are going to move at the same time mostly most of them just stand still and play some animations (working animations),

chrome bay
#

The trouble is, with 1,000 actors, the engine is going to be spending an awful lot of time deciding what to actually replicate to whom - so server performance will tank linearly

subtle cliff
#

all of the mare replicated since the start of the game

chrome bay
#

So at the very minimum, I'd probably be replicating that info via some kind of proxy actor

#

And potentially divvy the information up into your own clusters or buckets.

subtle cliff
#

I meant all of them are always relative

chrome bay
#

Even if they aren't moving, the engine will still be processing them for relevancy, dormancy etc.

#

And it's not threaded, it'll just be a long as linear loop, for every actor, for every connection. Quickly becomes an N^2 problem

#

So some kind of replication proxy which replicates info for many of those actors at once is probably a good start

#

And I also wouldn't run any movement simulation client side.

#

Just smoothing

subtle cliff
subtle cliff
#

and is smoothing really different than predictions?

#

Manor lords used a vertex animation plugin that only works on actors. but of course manor lords is single player so its way easier for it, it can simply use pawns with a very leight weight movement component.

#

But I am wondering is the unreal engine this bad for too many NPCs in the game,

chrome bay
#

Sure, all CMC does (for sim proxies) is when it gets a transform update, it snaps the capsule instantly, but offsets the mesh. Over time the mesh just blends back to its default relative location/rotation. Very trivial to do

chrome bay
#

Vertex Animation is interesting but bounds would have to be large enough to accommodate it. Presumably they did they to save on scene component transform updates, but again there are ways to mitigate that.

subtle cliff
#

So games like age of mythology, the retold one, or strongholds serires, how those handle that many NPCs in a multiplayer game

chrome bay
#

custom engines usually

#

Whether Epic admit it or not, Unreal is a shooter-based engine

#

And the tooling/out-of-the-box stuff is geared towards that

subtle cliff
#

Well, if my project wents well, I find a way to get access to private engine desgiend for RTS 😂 for next projects

subtle cliff
subtle cliff
chrome bay
#

As in the bounds of the component. If you offset the vertices on the GPU, the CPU-side bounds still need to encompass that mesh otherwise it won't draw

#

But increasing the bounds is obvs going to make it more likely to be submitted for draw, so is a performance trade off

#

If Manor Lords did something to "smooth" characters with vertex offsets instead, my bet is they increased the bounds dramatically in a bid to avoid lots of scene component updates on the CPU, which are also a bottleneck at high actor counts.

subtle cliff
#

Many Thanks, Also I have just done a research. Although still believe UE is not the best engine for RTS, but there were games like Tempest Rising
that are multiplayer and has about 400 on case of 1v1 in its multiplayer

#

and also there are other games too, so there should be a way to get around 1k soldiers/ workers in a multiplayer environment.

#

Also Ancestors Legacy seems to have quit large number of npcs in its game

round mist
#

Are there any alternatives to listen servers and dedicated servers these days for more server authority driven multiplayer games?

I really only need a server for rng and simple number-based stat tracking. The mechanics are simple enough that almost everything else can be handled locally.

Is there a solution I don't know of that doesn't require me to pay for long term server hosting for the lifetime of the game?

subtle cliff
round mist
#

They could modify the rng locally.

subtle cliff
#

aren't there anyway to prevent host from doing so. I am not an expert about cheating but I think there should be a way that you can use something like an anit cheat to stopp host from cheating

dark parcel
#

Not really and it would be a waste effort.

subtle cliff
#

Also, you can use seeds and somehow find a way to generate the same series of seeds at the start of the game on all clients and the server, and then you can create a system that check if all players end up using the same seed for the rng then it means no one cheated

round mist
#

Possibly, but from what I've read, server authority is the best way to handle it.

I'm looking into peer to peer authoratative models right now where each player would basically agree on a seed based on a time stamp or something and roll a number based on that.

round mist
#

Could it be as simple as using the time stamp and maybe the current game state (stats or something) to generate a seed from?

dark parcel
#

Using network clock is probably the closest thing you can use

subtle cliff
#

also you can use game session ID, which I think is the same for all paleyrs and the host

round mist
#

Yeah. I'd have to use some sort of clock to get a different seed each time.

#

This sounds promising though. All I've ever toyed with is dedicated servers and listen servers. Does Unreal have a way to do peer 2 peer like this out of the box? Via Steam?

chrome bay
#

Listen Servers are player-hosted

#

I mean dedicated could be too tbh

dark parcel
#

Unreal is not p2p out of the box.

chrome bay
#

Also keep in mind, there's absolutely nothing stopping players modifying the local state of the game even if they do receive the RNG seed from a Server

#

I mean even if you receive the RNG seed, you can just modify it in local memory

#

And that is extremely trivial to do

#

If you care about cheating, that's not going to solve it

round mist
#

Right?

#

Or am I misunderstanding how this works.

round mist
chrome bay
#

But how do you know the client has modified the value locally? You can't possibly know that (on the server)

subtle cliff
#

@chrome bay One quick question: For having the smoothness effect on characters or pawns on clients, is there a ready-to-use solution on Unreal Engine, or should I write something for myself if I don't like to use CMC and characters?

chrome bay
#

Nothing I know of, but should be very trivial to do one yourself

#

Projectile Movement Component has a simpler version IIRC

chrome bay
#

A client can cheat if you ever give client the authority to modify gamestate. If the Client for example, pulls a weapon out of a create and "tells" the server what they just pulled out, that's immediately an avenue for cheating.

dark parcel
#

@round mist reading above maybe you are doing some kind of damage system? The client shouldn't even have any say when it comes to damage.

If you want to predict, then fine do it locally but at the end of the day those number are just illusion because the server would be the one that implements the damage and sets the hp

#

So a player can cheat and change the value locally but it will have no implication on others.

#

In general you shouldn't predict anything related to damage though. Damage indicator should be just something that server do

chrome bay
#

I never predict damage personally. Far more confusing if you predict incorrectly

#

Generally big events like, especially if hard numbers are shown to players, are better when they're accurate

round mist
#

The game revolves entirely around dice rolling, but I would be using GAS to take advantage of status effects and I guess all of that would also need to be on the server.

#

The idea was kind of like how blockchain (as far as I'm aware with my very limited knowledge) uses peer to peer confirmation. But with only 2 peers it's a lot less secure, clearly.

The idea was that if both clients locally generated a seed based on values that should be identical for them both, then they'd generate the same number. and if those seeds didn't match up, then somebody is cheating.

#

But without a built in p2p system this is all pretty moot anyway cuz I wouldn't even know where to start with that.

subtle cliff
round mist
#

So I guess if I want PvP then I'll be looking into just simply server hosting solutions.

dark parcel
#

At the end of the day the auth figure can do w.e

#

So if you let your player hos the game, there is probably no way to stop them from cheating.

#

Listen server is good for co op and when you don't care about cheating

round mist
dark parcel
#

Ye I wouldnt bother preventing cheaters in listen server model

#

The host can just do anything to its instance.

#

E.g memory manipulation

chrome bay
#

listen server aside, you still want to maintain good practices generally. Kind of have to anyway if you want to support dedicated as well.

jaunty plank
#

Does anyone have any resources on how to create a traffic system for multiplayer games. particularly on how to spread out the traffic between all the players. Ive looked at some differnet approaches on the systems itself and will probably use splines as the road network is very varied in lane sizes and such. Would just calculating distances between all players work well for removing and adding ai traffic?

radiant cypress
#

Hey ! My Map has a Game Mode that has Dedicated Server logic.
If I want to also implement a "training" mode where a player can run a local instance of the map, what is the best practice ?
Should I duplicate the map and create a new game mode ? Is that the best to do ? As the duplicated map contains same assets, it wont affect the size of the game much, right ?

thin stratus
#

Which GAMEMODE_SHORTCODE points to which GameMode class can be set up in the ProjectSettings under Maps&Modes.

#

It's probably best if your GameMode can simply handle both, DedicatedServer and Standalone.

#

Then you don't need any new GameMode/Map/etc.

radiant cypress
thin stratus
#

Or in Blueprints probably IsDedicatedServer or so.

radiant cypress
little pumice
thin stratus
blazing spruce
#

Hi, I'm having an issue with my pre lobby widget, I've got 2 race conditions happening atm.. the first one is that I have the pre lobby widget being created on begin play of the player controller however the OnPostLogin event is called quicker which calls an event to update the UI on all connected players but because the pre lobby widget hasn't been created yet it doesn't do anything until its called again, but always when the player first joins it wont update their widget until someone else joins or they press the 'ready up' button to trigger the update all player lists event again..

The second issue is that OnLogout is called quicker than the Player Array on the game state actually removes the player from it so again it calls to update the UI on all connected players but it still includes the player who just left. Whats the best way to go about fixing these?

hollow bridge
#

Does the option "replicate movement" affect performance even if the actor doesn't move?

vapid gazelle
#

What are some tools available to me on Windows if I'm trying to diagnose why a very small subset of players struggles with ever hearing back from the server after sending it the first n packets at the very beginning of joinin a session.

I'm guessing they have some issues with their NAT settings or a firewall that prevents the server's response to them (UDP packets sent from port 7777 to some other port on their machine), but I don't have a super obvious way of testing that hypothesis without running some tests. Any tools that might be useful for this sort of debugging?

Update: ah, looks like 7777 isn't actually the real port here, it's Steam P2P Network's "channel". Looks like Wireshark is the way to go here.

fossil spoke
#

There isnt any C++ function that is called on Actors after the Server sends replicated data?

#

Like a PostNetSend lol?

#

PostNetReceive is obviously for Clients.

fossil spoke
#

PreReplication

fossil spoke
#
void APGObjective::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)
{
    Super::PreReplication(ChangedPropertyTracker);
    
    if (bActive && bWasInactiveForPreReplication && bImmediatelyCompleteWhenActivated)
    {
        // If we were Active and we are about to Replicate that change, then also call Complete since we want to make that transition straight away.
        // We have to manage this here because Complete also calls Deactivate, which will effectively cancel out the call to Activate for Clients.
        // This should cause bActive = true to replicate to Clients, from the call to Activate, while also sending the call to Complete in the next update.
        // While also allowing Complete to then call Deactivate without stomping on bActive = true for Clients.
        Complete();

        bWasInactiveForPreReplication = false;
    }
}
#

Welp lets hope that works.

#

đŸ€ž

fossil spoke
#

It works, just have to defer the call to Complete until the next frame.

#

I thought that PreReplication would have already gathered the replist, but seems thats not sufficient, you still have to wait for the frame to complete.

#

A PostReplication function would have been better lol

#

Though, that wouldnt account for if a property wasnt sent in that bunch and was instead deferred because of saturation or something

#

Mmm waiting for next frame would also have that same problem

chrome bay
#

PreReplication is before it decides to replicate or compare that actor. The idea is you can do last-minute property updates (e.g, replicated movement)

valid imp
#

When writing NetSerialize for a USTRUCT, is the size limit 64KB (size limit of an RPC)? I can't find any doc on this at all online.

thin stratus
#

That question gives me NPP PTSD.

#

Isn't that the exact shitty reason they wrote that Bypass for the ServerRPC in NPP?

#

Maybe not, maybe that was just bandwidth limit in general.

chrome bay
#

when you remember that Epic doubled up on all the RPC's in NPP too lurkin

thin stratus
chrome bay
#

I do think 64Kb is the max packet size though yeah

#

Although RIP if you are actually anywhere near that

nova wasp
#

Rpcs can split into large data

#

At least in the regular net driver

#

As for how that works exactly I don't know

#

I'm wondering if I should try an http stream or something for certain large things

thin stratus
#

Where does that limit actually come from? MTU can be chosen after all.

#

Within limits that is.

#

Which step in the whole transport applies the 1024bytes? I know Ethernet sits at 1500. IPv4 at 64KiB.
Lower values would mean less delay of course.

chrome bay
#

Oh sorry I meant UE's enforced packet/bunch size

#

Once code leaves UE I am a simpleton br_smile_tiny

thin stratus
#

Right, I think I see now. So we got like 1500bytes due to Ethernet. IPv4 routers would fragment packets that are bigger than that.

#

There are risks of Routers dropping packets that are too big, instead of cutting them apart, sending back an ICMP that the packet was too big.
Some Routers (I guess IPv4 by default) do both, they send it but also annoy the sender about it.

#

Given that IPv4 encapsulates the data, so adding additional bytes on top, I would assume the 1024bytes by Epic might just be a "That will make sure things fit." number.

#

Sending data that is bigger than 1024 (or fwiw 1500) would I guess already be cut into pieces on the NetDriver level, to avoid any problems with other services (e.g. Router) to begin with.

#

That's my understanding at least. Doesn't necessarily prevent you from sending a lot of data though.

nova wasp
#

I raised it and ensures yelled at me

neon temple
#

hey, what's the best place to store api keys and other sensitive data?

thin stratus
thin stratus
#

Probably just that. Standalone across 2 PCs is not really wanted.

#

You usually package and use the same packaged version on both.

#

You should also have this in your logs.

UE_LOG(LogHandshake, Log, TEXT("Server is running an incompatible version of the game, and has rejected the connection. ")
    TEXT("Server version '%u', Local version '%u', Server features '%s', Local features '%s'."),
    HandshakeData.RemoteNetworkVersion, LocalNetworkVersion, ToCStr(RemoteNetFeaturesDescription.ToString()),
    ToCStr(LocalNetFeaturesDescription.ToString()));
#

Different NetDriver. You shouldn't even be able to connect by IP if you use Steam

#

Server and Client need to use Steam.

#

The error you get is one you'd get with and without Steam though. So not sure.

#

You don't. If you develop a Multiplayer Game with Steam, you are doomed to test with 2 PCs and thus properly package.

#

The Version error can potentially be fixed by ensuring that both provide the same version.
You'd need to check the Source code for what UE is actually comparing there.

#

Yeah the NetworkVersions are different.

#
        const uint32 LocalNetworkVersion = FNetworkVersion::GetLocalNetworkVersion();
        const bool bIsCompatible = FNetworkVersion::IsNetworkCompatible(LocalNetworkVersion, HandshakeData.RemoteNetworkVersion) &&
                                    FNetworkVersion::AreNetworkRuntimeFeaturesCompatible(LocalNetworkFeatures, HandshakeData.RemoteNetworkFeatures);
#

@steep abyss You can try to use networkversionoverride as a console command to maybe set it to something that is compatible on both sides.

#
    // add a cvar so it can be modified at runtime
    static FAutoConsoleVariableRef CVarNetworkVersionOverride(
        TEXT("networkversionoverride"), ReturnedVersion,
        TEXT("Sets network version used for multiplayer "),
        ECVF_Default);
bright summit
#

Are you trying connect packaged build to editor game?

thin stratus
#

And both were packaged with the same changes?

#

Again, Server and Client also need to use the same SteamNetDriver setup.

valid imp
exotic wasp
#

that's a giant packet

valid imp
#

So should any NetSerialize implementation I do not put more than that in the archive? I thought I could get away with a bit less than 64KBytes (size of UDP)

chrome bay
#

What on earth are you sending?

#

Keep in mind NetSerialize is generally used on structs that range from like 1 - 500ish bits or so by the time they're packed (very loose guide there)

#

And I do mean bits

#

UE replication is geared towards lots of high-frequency, small packets

fiery wadi
#

Hi I have been doing a lot of reading and have a couple questions regarding it, Wonder if someone can answer please.

1 : Whats the difference between a Run On Server custom event and a Switch Has Authority Node ?? (After all everything after the switch (The Server Exit Pin obv ) gets run on the server doesnt it?)

2 : If you have a non replicated event inside a OnRep (Which is run server side as OnReps as I understand automatically pass down all info to clients) does it still pass all the information from that event outside the OnRep?

3 : When should you use a OnRep or a Multicast (If all info is passed to clients from OnRep why do we need Multicast?)

4 : Run On Owning Client means that "Only run this on the local machine", Although I am not sure when you would make use of this as I play Dead By Daylight as a example I cant seem to think of an instance of when you would use a "Run only on this machine" without passing any information to the server to be validated first.. IE. Health Potion, or Survivor Perks etc.

I understand these might be basica questions but was looking for a laymans explanation of each and a "use" case scenario for each if possible please.

chrome bay
#
  1. Authority = You have authority over this actor locally. You can have authority over something you spawned locally as a client, or if the actor was previously replicated and "torn off" by the Server.

  2. OnReps only run on Server in Blueprint because they are a nasty, horrible hack. "Proper" C++ OnReps only run client side. Other than that, they are like any other function.

  3. Properties for state and/or anything that persists, multicast for transient events that you can miss. General golden rule.

  4. Run on Owning Client = either the local machine if you are the local authority OR the client who is the "net owner" of the actor.

#

If in doubt check the compendium

fiery wadi
#

Thank you for the reply! I have been reading a lot of differnet articles which is why I was looking for a clear concise answer here from someone whose knowledgable 🙂

blazing spruce
#

Hi, I need someone's help these race conditions are driving me nuts 😬 ive got my OnPostLogin telling the player controller to create the pre lobby widget to avoid a race condition where OnPostLogin is called before BeginPlay on the player controller, but now when i try to update the players list of all players in the pre lobby the game state cast now fails for the client so it doesn't create any of the WBP_PlayerNameCards like it does for the server player, how can i get around this so everyone see's the same shit

#

The other race condition ive got is that OnLogout is called before the GameState>PlayerArray actually removes the exiting player so when OnLogout calls to update all players lists it still includes the player who's just left

radiant cypress
#

I'm digging on making my GM logic viable for both Dedicated and Standalone. But I will have to use a "IsDedicated" Branch for absolutely everything, right ? Do I have to recode everything ?

#

Like, not only the GM

#

For example, in my character, some actions are locally done (i.e. shooting) without any change to the server, and done in the server at the same time, in order to give the player a smooth experience.
How do I make this LOCAL action (input action) "know" that it doesnt have to launch the fake shot, when in Standalone ? "IsDedicated" will only return false whether is Standalone, or simply the Client in a Dedicated environnement. So it doesn't know if it has to launch a fake shot in addition to the "real" one.
Should I create a custom variable that I set at the beginning ? Or is there a better practice ?

queen escarp
#

Hi, question, would it be possible for me to make a cross play game ? I mean so i can play from pc with a ps5 user without any licenses

lost inlet
#

well seeing as multiple cross-play unreal games exist... yes. but what does "without any licenses" mean

quasi tide
#

Technically - yes, realistically, no.

lost inlet
#

there are specific TRCs for it, but it's doable

quasi tide
#

Though, I guess it depends on your definition of "license"

#

EOS supports cross-play out of the box - but you need a license (it is 100% free, literally just make an account)
You could build your own servers too - but you'll most likely want to rent a server from some company, but you need a license
Could make your own internet as well - but you'll most likely want to use what is already in place, but you need a license to do so.

thin stratus
#

Wouldn't the PS5 part need a license, no matter if crossplatform or singleplayer?

#

Or what license are we talking about

subtle kernel
#

Original question is kinda odd. Play from PC with PS5 user?

#

What does it mean

queen escarp
#

Hmm license i mean like could a noob like me get it working p2p ?

#

I suppose

#

Or something

quasi tide
quasi tide
#

You'd still need a dev kit for PS to even release on the platform

#

So, you still need a license.

lament flax
#

i honestly dont see why you would want P2P when you got LS

quasi tide
#

Less resource intensive

#

But more headache's overall imo

queen escarp
#

Hm mkey but even with LS it sounds like its more advanced then watching 30min tutorial so guess thats out of the question then đŸ« 

thin stratus
#

It's mostly backend and platform involved. It's not even that much unreal engine related.

dark edge
#

almost nothing is true peer to peer nowadays

#

last game I know of like that mighta been Starbase

fossil spoke
#

Crossplatform is like the last thing you want to do as a new developer.

#

Focus on making a game that works first.

lost inlet
#

I remember "p2p" term got abused a lot around CODMW2 (2009) because that was all listen servers too

#

the EOS plugin does have support for EOS p2p, which is mostly just acting as a NAT punchthrough

odd hamlet
#

what is the way you compile your C++ visual studio file?
do you use this button here with enabled live codin?

I have seen that after i use that, i get a specific error:

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000018

UnrealEditor_LicenseGame_patch_0_PID_28616!FindFieldChecked<FProperty>() [C:\ProgramFiles\EpicGames\UE_5.3\Engine\Source\Runtime\CoreUObject\Public\UObject\UnrealType.h:6843]

UnrealEditor_LicenseGame_patch_0_PID_28616!GetReplicatedProperty() [C:\Program Files\Epic Games\UE_5.3\Engine\Source\Runtime\Engine\Public\Net\UnrealNetwork.h:223]

UnrealEditor_LicenseGame_patch_0_PID_28616!AThirdPersonCharacter::GetLifetimeReplicatedProps() [C:\Users\ycarp\Documents\Unreal Projects\LicenseGame\Source\LicenseGame\Private\ThirdPersonCharacter.cpp:125]

lost inlet
#

no

#

you close the editor and compile. live coding has limited uses that it won't corrupt your project, like modifying the body of a non-ctor function

odd hamlet
lost inlet
#

that doesn't change my answer

odd hamlet
#

like could be this the real reason it fucks up

#

because i been on this

#

for a bit

#

and i get frustated

fossil spoke
#

Especially for UE.

fiery wadi
#

I have this inside a BPEnemy which on BeginPlay creates a reference to the Widget to be used but I get a Accessed None for the W_HealthBar when changing the CurPercent value. I understand that Widgets are not replicated (Or at least the articles I,ve read and stuff say they cant)
The server can update the Health Widget no problem but when the client deals damage the health bar does not update on anyones screen. Im driving myself crazy trying to apply the Cedric's articles to this or the Wizardcells and numerous tutorials I have seen all do Player to Player HP modification and not like if 2 players are beating up the same enemy.
Please can someone help me before I drown in numerous articles and even more hours on youtube trying to work out how this is done.

quasi tide
fossil spoke
quasi tide
#

I'd say server meshing is even more niche

fossil spoke
#

True

#

The number of times i needed Host Migration I can count on no hands

quasi tide
#

It's a nice-to-have more so than a need.

fossil spoke
#

Agreed

fiery wadi
#

As you can see from the Images on Press of 1 (Inside the Player Character Blueprint) run the DealDamage and pass value of 100 which is in turn passed to a component which does the health reduction and returns a percentage for use inside a HealthBar I did add a Set CurPercent after the TakeDamage and ReturnPercent node (To trigger the OnRep function for CurPercent) to attempt to update the enemy health bar.

quasi tide
#

Are you doing the damage locally?

#

Is this a listen server setup?

#

Is the player the host?

#

Or the client?

fiery wadi
#

Yes its listen server.

#

I get a WHealthBar accessed none when using the Reference insside the OnRep.

quasi tide
#

How does the enemy get the reference to it?

fiery wadi
#

This is where i set the reference for the enemy player

#

So the enemy "knows" about their Health Bar Widget

#

but for some reason when the OnRep triggers it complainss "Hey we dont know about the health bar"

quasi tide
#

Could be a race condition.

#

Do a validated get inside of the onrep

#

Actors can receive onreps before BeginPlay runs

fiery wadi
#

like this ?

quasi tide
#

You can, or you can right click the property node and click "convert to validated get"

fiery wadi
#

server deals damage (from the server window)

quasi tide
#

Then if it isn't valid, get it.

fiery wadi
#

Client 1 deals damage As you can see it doesnt update on the others the same as it does for the server.