#multiplayer

1 messages · Page 690 of 1

short arrow
#

A listen server is much easier to set up for new players, you are correct, you are also correct about it being easily hackable

rotund badger
#

indeed, whihc is why I wouldnt use a listen server for a game where there is competitiveness

#

its just a fun game to pass the time, and i thought it would be neat if there was a multiplayer gamemode where you could invite your friends

#

and I also wanted to learn about it quite early in the project's life cycle because I don't want to launch promising something I cannot deliver

short arrow
#

Yeah that's fine, What I'm saying though is the same rules still apply. The client will still have to replicate to the server. (Most likely in the game mode) that it has beat its assigned level

rotund badger
#

thats fair, i can explain in more detail what I aim to do if that would help

short arrow
#

It would

rotund badger
#

I understnad a bit about replication and all that, because the client needs to check if it's instance matches what the server says is happening

#

basically, I want a gamemode where you load into a lobby, that can accept up to 4 people from a steam invite, from there, you can choose a map and a gamemode to go into, when everyone is ready, you load in and complete the level, and then you return to lobby

#

now I do see an advantage of having a dedicated server, because it means I could make lobbies where you can find random players rather than just friends

short arrow
#

You dont need a dedicated server for that

rotund badger
#

but that would be something i'd have to rent because the security issues and legal issues of setting up a server at home to handle that is not something id like to face lol

rotund badger
#

or is there protections surrounding that

short arrow
#

No, not really. Plenty of programs and games use listen servers

twilit radish
#

I would avoid dedicated severs if you can, especially if you’re making a casual game. They are expensive / time consuming to host 😅

rotund badger
#

how would you go about showing someone a list of lobbies if you use listen servers though? Because it would be impossible for one person's game instance to know how many server's there are surely?

short arrow
#

Because youre connected to a subsystem

rotund badger
sinful tree
#

What you're looking for is listen servers with session hosting.

short arrow
#

Onlinesubsystem

sinful tree
#

One player ends up being the host for the game.

#

Other players can join.

rotund badger
#

oooh ill have to look into that, that sounds quite good

short arrow
#

What I'm confused on is what you want to accomplish by writing to the game instance for clients?

rotund badger
#

oh no i dont mean game instance, as in the physical thing in unreal, i mean the instance of the program that is open on someone's computer

#

I take it, since I will be working through steam for this, that the steam online subsystem is what i'm looking for

#

i would be surprised if it isnt

twilit radish
short arrow
#

It is what you want. That's what will allow you to connect to or find other players

rotund badger
sinful tree
#

Ah the good ol' days of Gamespy looking for TF1 games... or the original Counterstrike games...

rotund badger
#

I'm kinda sad I missed out on classic Pc experience, my time was a mix between 3D pinball and PS2

#

was a console player for a while, only got a PC for gamedev

harsh lintel
#

thanks that solved my issue

pine reef
#

I'm spliting screen with the Create Player node on Begin Play of the level BP and saving that reference in game instance when I open a new level and check the game instance the variable returns None in Begin play on level BP ... Any ideia?

pine reef
#

the create player return node

sinful tree
#

I'm not sure if player controller references can exist between level changes just like you couldn't save a reference to an actor in the game instance.

#

Best you could maybe do is store whether or not there is more than one player in the game instance, and then recreate the player controller after the level transition.

pine reef
#

so how can I remove one player, cause If I redo the create player node it will make screen split in three

sinful tree
#

Ok, so it looks like the game will still remember that you have two players, it's just the old reference goes null.

#

It's probably recreating it for you automatically.

pine reef
#

yeah, but when it loads the camera is in weird position, so I thought I could fix by possessing it

#

but without the reference I cant

woeful fox
#

I am just starting with replication, and I'm running into a gap in understanding from previous networking systems I've used- is there mechanism wherein a client can have authority over the position of its character controller but the server can constrain it such that "impossible" behaviours don't occur? For example, enforcing a maximum movement speed by rubber-banding the player back if they exceed it, to avoid cheating

sinful tree
pine reef
#

no

hollow eagle
sinful tree
# pine reef no

I'm going out on a limb here, but I think you may be using incompatible game mode / game state. If you use game mode base (or child thereof), you need to use game state base (or child thereof). If you use game mode, you need to use game state.

woeful fox
pine reef
#

this delete, so Im going to create a new one at every level

woeful fox
#

I'm used to first-class prediction, wherein roughly the same simulation is run on both sides, and while the client may be "authoritative", there's a threshold condition wherein the server will override it and force the client's state to the new state, or "fold in" the client's close-enough value

hollow eagle
#

That's basically how this works, but I wouldn't describe that as client authoritative. The client is at no point just telling the server what position it is in.

#

The client sends the moves it is making and runs them client-side, the server runs the same thing server-side. If the server disagrees with the result, the client corrects its simulation.

woeful fox
#

So a call to HasAuthority on the controller would return false for the client, under the "normal" setup, then?

hollow eagle
#

Correct.

woeful fox
#

This prediction layer- I assume it's working by RPC'ing inputs instead, then updating itself to guess what the result will be?

hollow eagle
#

Basically. It's not RPCing the inputs directly but that's the simplest way to think about it.

sinful tree
#

It's a series of saved moves that are sent to the server.

#

The server plays them back, if it works, the server allows the movement.

hollow eagle
#

CMC is annoyingly complex... at some point it'll probably be torn apart and simplified when the new network prediction plugin is ready.

sinful tree
#

If it doesn't it corrects the position.

hollow eagle
woeful fox
#

It surprises me that it doesn't do this as a first-class system, but it probably allows for more fidelity on speed-of-light compensation and chrono-shifting replay

hollow eagle
#

Prediction isn't a first-class system because it's both very hard to get right and also not super generic for any game. That'll change a bit once the network prediction plugin is finished.

#

In the meantime, CMC's prediction is pretty robust, it's just super specific to its own use.

woeful fox
#

ooo, that sounds exciting - I imagine it'll expose a threshold predictor system for non-speed-of-light-corrected predictions and then give a framework for organizing something like the builtin CMC in a modular way

pine reef
hollow eagle
#

The work on NetworkPrediction can be seen on github.

eternal canyon
#

From my understanding

#

In the sense of sending inputs

hollow eagle
#

Also, the gameplay ability system has its own prediction system

#

not complex enough for character movement, but it works well for abilities

eternal canyon
woeful fox
eternal canyon
#

Idk how to not show previews on mobile

woeful fox
#

thanks- I'll check this out in the morning ^^

grand kestrel
#

Prediction is easy, it's rewinding characters for projectiles that gets tricky

vivid seal
#

have you guys actually implemented rewinding or are people just kind of trusting the client and checking that the target the client thinks he hit isn't more than x distance away and the hit location is within client line of sight

twin juniper
#

But you don’t « trust the client » you checking those things on the server

vivid seal
#

i just mean you trust the client as far as allowing them to send you "i hit this guy at this location" and then rather than rewinding to 100% check that the hit actor was at that location at that exact time, you just check that the location isn't absurd and the guy could've been there based on where he is now

hollow eagle
#

It depends on the game... there are absolutely games that do full rewinds.

vivid seal
#

i know, im just wondering if you guys in this discord have personally implemented full rewind

#

and if so how much work was it?

#

i can't wrap my head around how to get animations synced up perfectly, but i haven't actually tried it yet

dark edge
vivid seal
#

i just mean if your hitboxes are tied to the skeletal mesh, you'd need animations for the rewind to be accurate, but i agree that sounds like a ton of work

#

i know valorant does that but i wonder if smaller games have bothered or if thats something you do for AAA esport titles because you need that fidelity and otherwise dont bother

dark edge
#

Most games don't even have animation phase synced. Sounds pretty rediculous actually. It's not like heads move that much in a run cycle.

hollow eagle
#

There's a very specific set of games that absolutely do. Any tactical shooter (CS:GO, Valorant, R6 Siege) for example.

#

Honestly, most competitive shooters probably do.

grand kestrel
#

I only save hitbox location/rotation for rewind, don't bother rewinding full pose, I don't remember the precision but think they were compressed without any, or 1 point at most, felt flawless

#

I don't want to share my solution for rewinding characters being hit by projectiles because I feel like there are a million ways to approach it and I don't want to put my solution into anyone's head to distract them from a better way 😄 I'm not happy with it at all, even though it was 'good enough'

fossil veldt
# vivid seal i know, im just wondering if you guys in this discord have personally implemente...

I've done half rewinds before and it wasn't trivial, doing full rewinds in UE is kinda tricky because it tends to imply that your simulation runs somewhat deterministically and that the animation state is always going to be synced perfectly to the server, Animation blueprint just isn't really designed that way, however what did end up working well enough for me is to build a pose timeline from snapshots, and then you can just rewind locally, as long as you don't mind that the animation part of the rewind is client authoritative then it works okay

#

Valorant has a pretty good vid somewhere explaining how they did their rewinding, it's likely out of range for anyone without a big team since they made some pretty big edits to the engine but worth looking at still

karmic jacinth
#

Is this fix still required in the Engine source in order to build a dedicated server in UE5? https://forums.unrealengine.com/t/how-to-package-the-game-with-server-target-setting/232377/11

noble junco
#

I don't see an answer to a question I have: I am trying to make an exploration "game" for my son. Think 'Universe Sandbox2' but where you can land on statically generated planets and moons and explore them. Currently there is no other mechanic. But I cannot find a white-paper or even a tutorial on how to attack the issue of map size, where in essence it needs to be partitioned across servers to allow for n-number of solar systems. Assuming that no single server could handle a dozen players with a map size that encompasses a galaxy of solar systems. Anyone have any pointers or thoughts on this?

silent valley
wary sand
#

Hello guys, so when I run the test multiplayer server, and I put in the constructor of my playerController a print of the PCs names: I get printed at lunch, MyPc0 created, MyPc1 created, MyPc2 createed ( with 3 players and the listen server mode ), issue is, when in game I print the PCs names of my pawns, I get MyPc0 for all of the pawns in game, wether it's on the listen server/client1/client2 and I get the getControllerId = -1, I don't understand why, as the constructors are rightly called for 3 different PCs at lunch, maybe locally every PC consider himself MyPc0 ? Shouldn't they had least have their identifier different, given on connexion ?

wary sand
# wary sand Hello guys, so when I run the test multiplayer server, and I put in the construc...

The latent issue, is that I try to access the class variable of a certain client PlayerController by making an RPC from that controller and giving a ref of the controller in the RPC arguments (using "this" in the playerController class ), but this only works on the listen server because it seems he is the only one that is giving the right reference to his own PC in the process, I feel like clients are giving a ref to the PC of the listen server too, there must be something I'm missing ?

noble junco
blazing socket
#

Does PostLogin for the server run before BeginPlay?

verbal tendon
blazing socket
#

I'm creating a map of spawn point to playercontroller in the GameMode at BeginPlay. Then assigning the spawn point to PC at postlogin. works fine for client, not serve

sinful tree
# wary sand Hello guys, so when I run the test multiplayer server, and I put in the construc...

In multiplayer, every client sees themselves as PlayerController 0 as player controllers only exist on the owning client and the server. Other clients do not get references to other player controllers.
In your situation as you're running a listen server, one of the clients is the server, and so, they would see multiple player controllers.

Typically it's best to avoid referencing player controllers by ID in multiplayer games.

verbal tendon
#

@wary sand also good to not get into the habit of using the constructor, use BeginPlay

blazing socket
#

Kinda silly that login is being called BEFORE beginplay

sinful tree
wary sand
wary sand
blazing socket
karmic jacinth
#

When I try to connect to my dedicated server, I successfully join the game but for some reason I can't seem to be able to do any inputs. Any idea on what could be the problem? I don't have any issue with the "Play as Client" option in the editor.

rose prawn
#

Hey people, is there anything to worry about array inside array in terms of replication?

rose prawn
#

Let's say I have a MyItemsArray and I do something like this: MyItemsArray[2].AttachedItems[7].Durability = 3.0f;

#

Would it update the entire MyItemsArray[2])?

meager spade
#

eh

#

you accessing the item at 2 in MyItemsArray, then accessing an item at 7 on its memory to set durability

#

so what do you think?

rose prawn
#

Hmm, thanks

karmic jacinth
#

Is there any way to set a specific FPS for a dedicated server? I see an option to set the FPS in the simulator.

twin juniper
#

Is the listen server running each player's player controller?

#

so if a player for example presses a key to spawn an item that should only be done on the host with HasAuthority

bitter oriole
grizzled stirrup
#

Is GetOwner() guaranteed to replicate down before any properties?

#

So clients would get a valid pointer from GetOwner no matter how early they call that func?

wary sand
hard hinge
#

If you do not define an online subsytem, can you still connect to servers by their ip? open my.ip.address Or better yet, is a custom online subsystem required for basic connection to an IP?

#

I heard something about the null subsystem only working on LAN. Is this true?

#

I think someone said that on here. I will not be using any of the built in features of the subsystem, I only will be connecting to servers either using: APlayerController::ClientTravel or open my.ip.addr

#

That's fine. I can setup proper load balancing and such to handle direct IP connections.

#

I just wanted to know if it works and it sounds like it will, so that's awesome. 🙂

#

The subsystems feel a bit overkill for a lot of the stuff I want to do as well. 😄

verbal tendon
hard hinge
verbal tendon
hard hinge
#

Load balancer would only be used in production if there are any issues with connecting to servers 😛

karmic jacinth
#

Is there some kind of event for when the possess gets replicated to the client? Because the On Possess event is only run on the server side.

vivid seal
#

I said On Client Possess but it turns out that's a function I made in c++, looks like I call it from AcknowledgePossession in the playercontroller

karmic jacinth
#

I see that it send back an ACK to the server to confirm as well.

vivid seal
#

I believe that is called on all machines, so if you only want to add some client logic make sure to check against role

#

er, not all machines, but server AND owning

karmic jacinth
#

There's only one Controller per game instance no?

#

Well if I run on listen server though that would be a problem of course

vivid seal
#

in that case you can check IsLocalPlayerController()

karmic jacinth
#

Yeah that's what I was going to use.

#

Thanks for the method! 👍 They should expose this event to blueprint it would help some people.

vivid seal
#

agreed!

soft dawn
#

Is clienttravel the correct thing to use if I want to defer travelling back to the server online lobby until the client decides to leave post match screen? When my match ends, players will get a widget displaying the match stats and a button to go "back to lobby". Server will travel to lobby map as soon as game ends and then clients only travel back to lobby once they click the button.

shrewd violet
#

Hi guys, i'm new here

I have a basic NetMulticast func in C++ (in a component class) that is called on the server
In my printouts, i only see the Server receiving it, BUT im expecting clients to receive it as well as per the documentation

However, if i run that C++ code in Blueprints, clients do receive it as expected

is there some sort of oddity where Component NetMulticast does not work in C++?

woeful fox
#

AI players perform actions, and those need synced up; You'll see better scaling with AIs than with players, because the AI actions are only sent to players, while an additional player adds another destination for all traffic as well.

#

each new player adds AI*N*P traffic, while each AI just adds AI*P

dark edge
#

Depends on what they're doing. Think about the minimum amount of data needed to represent the game state. That's what needs to be synced to everybody.

#

A player will cost more bandwidth than an AI because not only are they generating more data, they're another client you need to send data to

woeful fox
#

that's what I said 😛

woeful fox
#

er...

#

depends on what you mean by "client to server load"; see, the client also needs fed data by the server, for updates by everyone else

#

at which point, we could repeat our answers from above but they'd just be a repeat of the same ones

hollow eagle
#

The cost of replicating a player from the server to all clients is no different than the cost of replicating an AI controlling the same character.
The additional network cost a player brings is purely due to having to take input from and replicate everything to an additional client, or because you have deliberately designed a game where players control something with more complex replication.

#

That's just network cost. This has nothing to do with the performance of the server or clients.

solar stirrup
azure hollow
#

can someone tell me if you need to publish your Steam store page in order to do some beta testing with a bunch of people? Is it possible to test without publishing the page?

chrome bay
#

You don't have to publish the store page, you can generate keys and distribute them still.

azure hollow
upbeat basin
#

Is there any logic to set my TimeHandle as replicated for my respawn counter? I wanted to replicate it so I could reach it from clients to show the remaining time in UI but apparently GetRemainingTimeByHandle doesn't give the actual remaining time on clients. Should I just fake the remaining time on client side by saving the death time + respawn time?

chrome bay
#

Not used the playtest feature so not sure how that works. Probably better off consulting Steam documentation.

#

But either way, you can distribute keys without publishing to the store front.

azure hollow
#

cool, thanks!

keen halo
#

Hey,

I have a Multicast RPC that some of the clients might not need to receive.
Is it more or less performant to send multiple Reliable, Client RPCs, to the clients that I know need to receive the information, than sending a reliable multicast to all clients.
A scenario could be that there are 20 clients, but only 10 need the information.

fossil veldt
#

We use it on VAIL for our alpha testing, tis pretty kewl, I know super people uses it too

#

Only thing that sucks is you can't let specific people in if they request, it is just random

fossil veldt
#

At the end of the day you're just sending a UDP packet with a header

#

Multicast tends to be the most expensive RDP type anyway, but honestly I wouldn't worry about it, make it work in a logical way, then network profile

neon thistle
#

I have some physics nodes being called by the call of Input Axis events. I would like to replicate those nodes as they don’t work with 2 players, but I have no idea, I tried with the RPCs but it didn’t work, any help?

rich locust
#

and input will never go through the authority

flint star
#

hey I have a question about projectile movement component
I'm trying to use it with networking, by using the interpolated component
the idea is, that server moves the root component and clients receive the position and interpolate the mesh

the problem is, that on clients it also causes the simulation to occur, which doesn't seem intended. Shouldn't the simulation only occur only on the server?

#

the problem I have is that the projectiles on clients instead of stopping when they hit a wall, they wall to the ground

#

kek
obviously I found the answer 2 hours into fiding the issue, but 2 minutes after I asked

#

bSimulationEnabled should be set to false on clients

neon thistle
naive minnow
#

Currently trying to make my character rotate to face a clicked point.

I've attempted using SetActorRotation, but it will either instantly snap the character to face the direction with 0 interp speed, or not turn completely with a higher number.

Its used as part of a command to make the character face in a direction and attack.

winged badger
#

clients then just tick their version of the Actor, which doesn't replicate position or movement while staying pretty damn accurate

winged badger
flint star
#

So you mean you simulate on clients as well, but don't replicate movement?

winged badger
#

yes

flint star
#

hmm

winged badger
#

only time you need to do anything different

#

is if the PMC gets affected in flight due to player actions

neon thistle
#

the torque node doesnt go over on the client and add torque

flint star
#

@winged badger tried looking into how UT does it and once again, they have semicustom solution with fake projectiles and replicating position on their own 😐

winged badger
#

replicating position takes resources

#

and you don't want to spend any you don't need to

rich locust
#

why would you need a real projectile on a client

flint star
#

I'm just worried that it will be behind on clients

winged badger
#

you can't notice the difference with 30 replicated actors on your test level im guessing

#

but with 300+ the actor replication will get staggered

#

and replicating position becomes more and more choppy

flint star
#

well the projectiles I work on won't be used for guns, so that's kinda fine-ish

#

i only used them for grenades

#

guns are hitscan

rich locust
winged badger
#

the projectile will be exactly as far back on clients as the rest of the simulation

rich locust
#

both server and client use the same physics tool

#

if you launch it the same both way

flint star
#

yes, but the state might differ

rich locust
#

it will be sameish

flint star
#

for example on client which is behin, the enemy will move to the side

#

and it wont hit it

rich locust
#

welcome to multiplayer 101

flint star
#

then I have different state

quasi tide
#

Physics isn't deterministic though. Could run into issues.

flint star
#

PMC is deterministic

#

doesn't use physics

winged badger
#

nobody suggested using physics yet

quasi tide
winged badger
#

watch that, talks about lag reconceliation

rich locust
#

even valorant has its problems\

#

peakers advantage

#

it is multiplayer 101

#

you just need to hide it well

flint star
#

sure, but using replicated movement makes sure one of the issues is semifixed -> only server is authoritative, no desync
by eating more networking resources, yes

winged badger
#

and also, you always do the simplest implementation first then iterate as needed

rich locust
#

in valorant if you peak you have the advantage of seeing the enemy before they see you

winged badger
#

you don't do 12 steps ahead

flint star
#

i'm in the iteration phase RN 😄

rich locust
#

lets say you synced it with a player that has 50 ping

#

how about a player with 80 ping

#

how do you plan to sync it with everyone the same way

#

because if lets say

#

you delay the server explosion by

#

.5 seconds

#

to match with sync issues

#

you will have a player with 10 ping

winged badger
#

the way to sync it is to use CMC replay

rich locust
#

which their bomb explodes earlier

#

cmc uses movement prediction

flint star
#

nah man, listen server with full authority, I'm not touching lag reconciliation, not a pvp game anyway

winged badger
#

you will be fine

rich locust
#

then you are fine

winged badger
#

with replicating just velocity then

#

and setting it on PMC on BeginPlay client side

#

the original position gets synced during process of spawning a replicated actor

#

so you're good on both variables that drive its position over time

flint star
#

i guess I'll try

#

the only 2 issues after that to fix is pooling (of replicated actors, so thats gonna be fun)
and I want the client to have some kind of fake-ish projectile immediately, which get's swapped for the replicated one later

#

looks weird if I throw a grenade and it appears after 100ms

winged badger
#

if you can guarantee both client and server decide to spawn the actor with the same name

flint star
#

I can spawn the pool only on server

#

and replicate it down

winged badger
#

you can spawn it separately on client and server

#

and network it after the fact

#

and just make the projectile travel little slower on clients

flint star
#

does that have any advatnages?

winged badger
#

it does, but its also fairly complicated to pull off

quasi tide
#

I've seen plenty of games that do just wait for the server to respond with the okay to spawn the grenade. In the world of networking - most players understand why it happens.

flint star
#

i mean if I pool the actors, they will already exist on both, so I can prepare it on client I guess

winged badger
#

networking actors after the fact generally needs you to lie to the engine

flint star
#

and they should already be synced, all I need is to make sure server and client selects the same actor

winged badger
#

make it think those actors were loaded in with the level

flint star
#

yeah I think child actor component does that

winged badger
#

ugh

flint star
#

seen something like that

winged badger
#

CAC is evil

flint star
#

it is 😄

#

but sometimes it's a necessary evil

winged badger
#

don't forget to turn on dormancy while those actors are not in use

#

no reason to evaluate them for replication

cursive iris
#

Quick question.. about how Data Assets work when passed in RPCs -

If I pass a pointer to a Data Asset pointer as parameter through an RPC, does it send all the properties (and use bandwidth equal to the total size of all the DataAsset's properties)?
or does it just send a pointer (and use bandwidth the size of a single pointer) and then Unreal uses the AssetManager to find the asset's definition on the receiving side?

#

Like... for just getting properties over a network and not writing anything should I just be passing a TSubclassOf? or a StaticClass?

#

hmm.. yeah. I understand. Just trying out DataAssets and AssetManager on a new project over the weekend... and the DataAsset is currently too small for me to see if it's sending something huge over the network or not using Stat Net, and setting up the NetworkProfiler just out of curiosity sounds like overkill

lost inlet
#

references to assets, including data assets, do not replicate their properties. it's just a reference to the asset itself

rocky topaz
#

I'm considering about how I should implement melee attacks in my game
the player has a lot of movement so they should be able to avoid it
I was thinking about having a sphere attacked to the claws of the enemy that starts listening for overlaps at a certain point in the anim then stops
the only issue is that I don't know how multiplayer friendly this is, will the listen server be ticking the anim bp if it's player doesn't see the enemy ?

#

and if so, will the sphere be at the right locations to detect the attack?

slim mist
#

Hi folks, I attached a gun to a skeletal mesh's hand socket and am driving the hand position via IK from the user's VR motion controller. When firing the gun, it is firing as if the hand hasn't moved, however all clients see that the hand and the gun are moving. This leads me to my question - does a dedicated server not animate the IK of a skeletal mesh, thus meaning it wouldnt have the correct placement of the gun?

rocky topaz
#

why not attach the gun to the controller directly ?

slim mist
#

the player's motion controller is driving the position of a mech's hand, and the mech is holding a rifle

rocky topaz
#

ah I see

slim mist
#

thanks for the input though

#

I just confirmed that it works on a listen server, which further leads me to believe it has something to do with a dedicated server not simulating the bones of a skeletal mesh

rocky topaz
#

@slim mist funnily I found the answer to your question while looking at my issue

slim mist
#

ooo

rocky topaz
#

you can make the clients send the transform of the gun to the server, the server would validate them first and then replicate them to other clients

#

actually you probably don't need to send them to other clients, only the server

slim mist
#

yeah, the other clients already have it lol

#

so I essentially send a server RPC to just manually set the guns transform?

rocky topaz
#

what about bone transforms when a notify fires? can I assume it's correct or not?

#

if what is attached?

hoary lark
#

dat necro

slim mist
#

omg lol I thought I was going crazy

hoary lark
#

dedicated servers don't render animations by default, i guess maybe vr controllers are included in that? but i don't know

rocky topaz
#

you can even do it on your fire I guess

#

you don't technically need to know it all the time

#

you can send the bullet origin location and bullet direction vector

#

then server side you can simply validate it to see if it's an acceptable value

#

also @winged badger sorry for bothering you but this thing is really hard to test out, please @ me when you see this

slim mist
#

Thank you so much @rocky topaz for the help. I'm still running into a weird issue but I think you're right on the money with the approach

winged badger
#

a replicated actor attached to a net addressable actor will move with its attach parent

#

as the AttachParent will replicate, and any updates to its position will update the position of the attached actor

rocky topaz
#

ah okay

#

I thought you were still talking about the anim montage thing

winged badger
#

as for montages and bone transforms, approximately

#

they will look more or less the same to a human eye

#

which doesn't mean you can use them to do some precision sync between client and server

rocky topaz
#

oh so if I need to do a 50 radius sphere trace every 0.02 seconds I can count on the transform to be good right?

winged badger
#

you generally don't trace towards a bone

rocky topaz
#

huh?

#

I mean a simple sphere trace with the bone as the origin

#

sorry

#

sphere overlap*

#

frick I'm loosing my words I need sleep

winged badger
#

yeah, but that sphere might be in significantly different positions on server and client

#

at any given time

rocky topaz
#

ah

#

so how would you make an AI claw attack apply damage as the claw sweeps through in the animation?

winged badger
#

can the players make a precision dodge?

rocky topaz
#

yup

winged badger
#

you'll need more sync then works out of the box then

rocky topaz
#

I guess I'll cry

winged badger
#

it is possible to sync network clocks

#

have server announce the attack beforehand

#

so it plays at exactly the same time from exactly the same position on clients

#

and use replay on server to determine if client was out of the way when the attack landed

#

as opposed to being out of the way when the inputs arrived on server

rocky topaz
#

how could I get the replay then?

winged badger
#

note that this is easily a week's worth of work

#

CMC

rocky topaz
#

I see

#

so while the CMC is skimming through replay I can figure out when the attack hit and where and know if the player dodged it or not?

#

I think I'll just make the ugly ping dependent one for now, I have 2 weeks to finish a ton of AIs and make the menus system

winged badger
#

you can replay players last few moves, and see if players position was out of the attacks way at the tiimestamp attack landed

#

without that, you can end up in a situation where player dodged the attack in its own simulation

#

but got hit on the server

#

and the chance for that increases with latency

rocky topaz
#

yeah I understand but if it's a week's worth of work I don't know if I really have time to deal with this

#

how would you do it btw?

winged badger
#

i'd start with searching for replay on this channel, see if someone actuallyy explained how it works in detail

#

incorporate dodge in FSavedMove so it can be handled predictively and replayed

rocky topaz
#

would I do something like, when the attack is done I cache the sphere trace locations on the server, then after say 1 second, I grab the players and check where they were at trace time on their own simulation?

winged badger
#

syncing network clocks and having AI announce attack at specific timestamp is trivial

rocky topaz
#

I've already had to play with the CMC to make my dash, slide & other systems

winged badger
#

then providing you find a good replay explanation (i never needed to do those myself)

#

you might accomplish this in 3 days

#

also note that this might get real expensive real fast

#

if we're talking 50 AI

#

if we're talking 3-5 at a time its fine

rocky topaz
#

well there can be a lot of AI but not many attacking at the same time

#

especially not in melee

winged badger
#

this is also much easier with very fast attacks

#

like bullets

#

as they are typically past the possible hit area in a frame

#

so you only have one frame to check

#

this is not the case with claw swipes

rocky topaz
#

yeah 😢

winged badger
#

and not 100% its even practical

rocky topaz
#

I mean melee is kind of a second thought in this game to begin with

#

there wasn't even a melee class before I thought it would be cool to add it

#

I think I'll make the ugliest solution and just say players need a 5ms ping to play

#

😂

winged badger
#

so its a feature creep?

rocky topaz
#

yes kinda

#

I mean it's supposed to be a doom style FPS

#

except they were missing dodgeable attacks

#

which made it very not doom like

#

I'm trying to make the game great again by making stuff dodgeable

#

but coop itself was a thing they wanted to add just cuz it would be cool

winged badger
#

a feature not on production level that doesnt tie well into the game is best cut

rocky topaz
#

I don't know

#

if it was up to me I would probably have cut coop

#

but well

twin juniper
rocky topaz
#

I think for now, I'll put two anim notifies on the montage one for the damage start and one for the damage end, then every 0.02 or 0.05 seconds I'll do a sphere overlap on the claw bone's location, you reckon that should work perfectly on a low latency situation right? @winged badger

#

I think we will advertise our coop as LAN only btw

winged badger
#

nobody plays lan these days

rocky topaz
#

🤷🏻‍♂️

#

I mean yes but also since we're in europe nobody has a ping above 15 ms these days

#

and technically even with a 150ms the anim is still has 1.2 seconds of windup

#

sure the hit window itself is 250ms so there can definitely be some last second missed dodges from high ping

#

but even AAA games don't handle 150ms ping well

#

and I don't think trying is a good investment tbh

#

my concern is mostly about what visibility optimization atm, you said bone transforms should be pretty much the same to their actual animation version on the server, even if the animation isn't playing on the server right?

#

( @winged badger )

#

also sorry for bothering you

#

I just want to confirm this so I can stop thinking about it and go sleep

winged badger
#

from what little i can tell

#

you should probably start cutting

#

how long till release? publisher involved?

#

(i thought it would be cool is a terrible reason to have something make the release version)

rocky topaz
#

no publisher involved but we need a prototype in like 18 days

#

we have a lot of prototypes btw but all of them were singleplayer

#

they have always wanted to do coop multiplayer

#

and have some kind of arcade versus multiplayer "that would be cool"

#

also couch coop "that would be cool"

#

I told them to scrap the couch coop cuz that's just waaaaaay too much of a pain

#

versus will be added probably post release and as an obvious extra

#

but coop is kind of one of the cores of the game as far as I understood

winged badger
#

and how does a tacked on melee fit into all that?

rocky topaz
#

as I said they have always wanted to have coop and had been wanting to have it in the game since the beginning but they had no dev (until they hired me)

#

ah you mean the melee

#

well there is a rhino that only hits in melee and as I said it's supposed to be a doom style game with dodgeable attacks

winged badger
#

we can afford some inaccuracies

#

as we can have over 200 AI running around engaging players at the same time

rocky topaz
#

yeah that's what I've been thinking too

#

like it's cool if the player can do a last second dodge

winged badger
#

i don't even care to replicate shots to simulated proxies

#

i just tell them the target, weapon and firing mode and let them draw their best guess

slim mist
#

@rocky topaz when I call the server RPC to give the weapon's location, it spazzes out in a similar manner to two overlapping physics objects. doesn't happen on listen server. any ideas?

#

super simple implementation

rocky topaz
#

bottom is called on fire?

slim mist
#

naw on tick. but it happens similarly to on fire

slim mist
#

it just spazzes out for 1 frame 😆

rocky topaz
#

having location updates on tick is probably a very bad idea

winged badger
#

i don't even guarantee a shot for shot

rocky topaz
#

btw you didn't answer my question about the accuracy of bone locations @winged badger can I assume it's precise enough to use it as the origin of a sphere overlap?

winged badger
#

for precise dodge, probably not

#

montages will be out of perfect sync, so will positions and rotations

#

and there is the matter of having players dodging get to the server

rocky topaz
#

even assuming it's on LAN?

winged badger
#

i would never assume something is on LAN

rocky topaz
#

hum

#

I mean since it's a coop game with listen servers

#

I could technically do the damage testing on each clients

#

I already "trust" the coop game host client so might as well trust the other clients too

winged badger
#

that is also something i'd never do

rocky topaz
#

why not?

winged badger
#

we have listen servers, and players get really annoyed when someone uses a trainer

#

now over time hosts doing that don't get any players joining them

#

but if clients could just join and do that... ouch

rocky topaz
#

but it's a coop game, and if they don't like their friend using cheats they can always tell them to not use any

twin juniper
#

Yah unfortuynately a listen server means giving direct power to the host

winged badger
#

so is ours

#

doesn't matter

twin juniper
#

Who can easily inject into the game

#

and manipulate game memory

winged badger
#

host is still much more responsible party

rocky topaz
#

we won't have online random multiplayer

winged badger
#

then a random joined player

rocky topaz
#

only "friends" multiplayer

winged badger
#

say you have a 8 player coop

rocky topaz
#

4 max

winged badger
#

and 5 players who usually play together start a game one of them hosting

#

and 3 randoms join

rocky topaz
#

(as I said no randoms)

winged badger
#

then 1 of those randoms turns on no skill cost or cooldown cheat

#

never ever trust a client, listen server or not

twin juniper
#

ALthough,

#

even friends playing together

#

even a. friend

#

If they are granted certain privleges for a client

#

can still place cheats

#

If you don't utilise the hasAuthority correctly

winged badger
#

you have to let client calculate some stuff

#

but you do need to verify

rocky topaz
#

ok so back to my original solution then, I'll just do sphere overlaps on the server and screw lag optimization

winged badger
#

you'd do better with a box then

#

it covers the area where you get hit in one frame

#

instead of sweeping

rocky topaz
#

I mean the game can still be played as a solo game

#

it wouldn't be nice to remove a solo/low lag feature just because it does work the same way as a box for laggy clients on multiplayer

#

my whole question is

#

assuming no lag, can I rely on bone location or will it be super buggy and off the spot?

winged badger
#

more or less

rocky topaz
#

if it's not being rendered because of optimization

winged badger
#

also they have to be montages, not animations

rocky topaz
#

can I just enable always tick pose when I run the anim montage and then disable it?

rocky topaz
winged badger
#

as animations won't fire any notifies unless its on listen server host's camera

rocky topaz
#

good to know 😳

#

@winged badger can I get the latency to a client and use both?

#

I could show some kind of "high latency" icon on the UI to show that the player is laggy and have the game work in different ways no?

#

the only issue would be where do I even draw the line

#

meh I think my sphere traces would work the same way as a "regular" big one anyway

chrome bay
#

Apparently causes some very spurious issues with GAS in particular since it makes such heavy use of it

winged badger
#

that on UE5 only?

chrome bay
#

I'm not sure, it looks like the original issue may have been in UE4

#

But was a really rare occurence

true grotto
#

Hi there! I'm trying to create a HUD but don't understand where I should call the create function. I've tried making calls from the controller's OnPosess function, but it's not a multicast or client-side function. Can someone help me please?

elfin echo
#

Please tell me how I can transfer the player's token when connecting to the server using open level by name?

rocky topaz
true grotto
#

When respawning, the controller remains the same, just moving to a new pawn

rocky topaz
#

yeah, you don't want to create a new HUD every time your respawn do you? you can simply reset it

true grotto
#

But what if I want to clear the interface when the player dies?

rare forge
#

Hi there! is it possible for me to use a home computer to be a dedicated internet server? I have already opened all ports 7777, disabled firewall, opened the ports on the router as well. and I can not enter with my ip only local works.

uncut ice
#

Let's say I want to build a RTS multiplayer game. What aspects of the unreal multiplayer framework do I need to consider? Does replication for 1000 units for example work or would I need some systems on top that for example manage movement of unit groups and replicate that. What are the benefits of using the multiplayer framework of unreal instead of using TCP + UDP to create my own?

chrome bay
#

Unreal is tried and tested and works, so there's that

#

(Also nobody should ever network games with TCP)

#

RTS has been done, but obviously you'll need to squeeze everything you can out of the engine to get the most out of it

#

So the answer is depends

#

Many RTS games use lockstep determinism, which is effectively impossible in UE.

#

As in, it's not, but it might as well be

#

Seen some games separate the simulation layer from the presentation/game layer though. Deserts of Kharak did that. Could work

eternal canyon
verbal tendon
#

There's no good reason to do MP games with TCP, and I've worked on older games that did it, not my decision. It was done because people didn't know any better and it was easy to do

#

🤦 my face when explaining to them afterwards that TCP and P2P NAT are not play buddies

#

Because essentially anything you get from TCP you can build on top of UDP without the inbuilt limitations

#

😄

snow turret
#

Hey, my Anim Notifies are only working on the server. Is this a known issue?

#

I've tried RPC

tranquil yoke
#

I have one question, when client pawn needs to move, using character Movement Component. do we have to set the location on server in order to replicate to all the clients ?
I previously thought, we move client on client side and the character Movement will automatically send it to server and the all other clients will get it from server ?

Can someone clarify this ?

slim mist
#

Does anyone know why UCharacterMovementComponent::AddInputVector stops doing anything in a Dedicated Server when ownership of the ACharacter has been forcefully changed?

virtual bool ForceSecondaryPossession(AController * NewController)
    {
        if (NewController)
        {
            PossessedBy(NewController);
        }
        else
        {
            UnPossessed();
        }

        return false;
    }
#

It works in a local environment and on a listen server, but not in a dedicated server. I've confirmed that the same input values are being sent to AddInputVector on both the owning client and the dedicated server

#

It works in a dedicated server when I DON'T use ForceSecondaryPossession

slim mist
#

The Game Mode, from OnPostLogin, is sending that player controller via a server RPC to the pawn, which then calls APawn::PossessedBy (via ForceSecondaryPossession)

#

Sorry, what does CMC mean?

#

Thanks. I've confirmed that the CMC:AddInputVector is being called from the owning client, if my understanding of your statement is correct

#

However, puzzlingly, the role on the local client is ROLE_SimulatedProxy. I would have assumed it would be ROLE_AutomonousProxy

#

IsLocallyControlled is returning true when GetLocalRole is returning ROLE_SimulatedProxy

#

spawned from the server

#

for some reason my hot-reloading of changed engine source code isn't having an affect in game, which would give me more insight into finding out what specifically is causing the change

#

the most I can do is add breakpoints which hasn't given me success for pinpointing

quasi tide
#

hot-reload bad. Live code good

slim mist
#

sorry, live code, thats what I meant. I use ctrl + shift + f11

hollow eagle
#

engine code isn't made available to live coding by default.

#

(or at all if you're using a launcher build)

slim mist
#

thank you!

#

line 517:

#

However, if I comment that out, then other things depending on this client being the owner are broken

sinful tree
#

Thereby, you're not changing the controller, but you've changed the owner.

slim mist
verbal tendon
slim mist
slim mist
verbal tendon
#

You've given context that you've modified the engine source, but the gist that you posted is the stock engine code, no mods. What are we missing?

slim mist
#

Because I'm having trouble with compiled changes of engine code showing up in game, I brought the engine code into my own function and modified it there.

void ASecondaryPossessionCharacter::ForceSecondaryPossession(AController* NewController)
{
        SetOwner(NewController);

        AController* const OldController = Controller;

        // Controller = NewController;

               // ...rest of function, abbreviated for discord
}
#

the only change i made was commenting out the highlighted line

#

to clarify - I made that change just to see what was causing UCMC::AddInputVector to stop working in a dedicated server

#

I dont have any actual reason or desire to comment out that line

#

I'm trying to figure out why UCMC::AddInputVector is not working in a dedicated server after calling APawn::PossessedBy, and I noticed that the specific line highlighted, when commented out, allows it to work. However, this is obviously not a solution, because it breaks other things

sinful tree
#

You are manually calling PossessedBy?

slim mist
sinful tree
#

Why?

slim mist
#

Great question 🙂 I want the player to have ownership over this actor, however the actor derives from APawn. It appears that in a networked environment, APawns are special in that ownership is only granted when it is being possessed

#

However, I can't have the player possess it, because they still need to possess their original character

#

Context: The player is possessing a VR character, and they are operating a cockpit inside of a mech. The mech is the APawn

#

This workaround of directly calling APawn::PosssessedBy was discovered by the creator of the VR Expansion Plugin, and apparently was also later adopted by FortNite for their vehicles

#

lmao my fitbit thinks me typing on discord is me taking steps

sinful tree
slim mist
#

If my understanding of your statement is correct, @dull lance, that would cause the player to momentarily leave the body of their VR Character. They are always staying within the body of their VR character and interacting with the world through that classes' hands, just as we do in every day life when hopping in/out of our car

slim mist
sinful tree
#

You can set the owner of a pawn to anything on the server. The ownership will replicate if the pawn is set to replicate.

slim mist
sinful tree
#

Yes. The only caveat is if the owner is set to a player controller, other clients who are not the owner will not see any value set for the owner.

slim mist
#

I don't know if its worth mentioning, but I'm on 4.26

#

Interesting, I'd be eager to learn

sinful tree
#

The thing is if the pawn becomes possessed, then the ownership changes to the playercontroller who possessed it, which is what you have here...

void APawn::PossessedBy(AController* NewController)
{
    SetOwner(NewController);
// yadda yadda yadda...
#

If it's never possessed, then the ownership will never change unless you manually set the owner (I'm fairly sure, but could be wrong)

verbal tendon
slim mist
sinful tree
#

That's because it's not controlled, you only set the owner.

#

Ownership =/= controlled by

slim mist
verbal tendon
#

Yeah I know, but ownership has nothing to do with this. Wondering what the actual problem is

slim mist
#

Using CharacterMovementComponent on it for simplicity

#

LOL

verbal tendon
#

The first C in CMC

#

is the hint 😄

sinful tree
#

Cool Movement Component!

slim mist
#

I really appreciate all of you spending your time and energy in this discussion, it means a lot

slim mist
verbal tendon
#

Yes wish you the best of luck, I can't chime in one the VR-based problems that you're experiencing since I've never worked on one of those

slim mist
#

I may have mischaracterized this challenge as being specific to VR - its not specific to VR.

#

I appreciate you bringing this up. Do you have any more time to elaborate on this?

#

Sorry, I don't understand the context with this statement. I am using ACharacter, and I am using its CMC.

verbal tendon
#

I haven't done this before, but gut feeling would be to make your vehicle a character, use CMC with it. Possess it on the server, call it a day

slim mist
#

I was referring APawn because that was the function being called. The class derives from ACharacter, however.

#

sorry for the confusion

verbal tendon
#

@slim mist is this in anyway a networked game where other players interact with one another?

slim mist
#

ACharacter::PossessedBy is pretty much Super::PossessedBy and then one other check

slim mist
verbal tendon
#

Define co-piloting

#

Two players 1 mech. One on guns one on movement?

slim mist
verbal tendon
#

Uhm 😄

slim mist
#

LOL

#

uh oh

verbal tendon
#

I mean I guess that's -technically- possible, whether it's a good idea or not is a different story

slim mist
#

Yes, I've been trying to communicate this...I guess I failed at it

#

Yeah I'd rather go the a) route, because then I'd have to implement the false-possession of the VR character for each vehicle

verbal tendon
#

Part of the success strategy for making it through game development is reducing your problemset

#

that means making the simplest and cleanest solution for problems that you have

slim mist
#

sorry for the confusion, when I said false possession I was referring to manually updating hand positions of the VR character to give the illusion that possession has never been lost

dusty radish
#

Hey, i think i'm missing something with replication. My function works server side but not on the client side. Can anyone see why?

#

when it's called by the client i mean

dark edge
#

@dusty radish just replicate the state of the inventory

dusty radish
dark edge
#

You need one of those to get from client to server

#

Input -> run on server event -> DoThing

dusty radish
dark edge
#

Show the ROS Event

dusty radish
dark edge
# dusty radish there it is

That's a really awkward event signature. If it's called remove item from inventory, it should just have a field for item to remove

dusty radish
dusty radish
sinful tree
dusty radish
#

I see, I think my GetPlayerController will be to blame then. This is the function

sinful tree
#

That it would be.

dusty radish
#

do you know of a way around that?

#

maybe pass the player controller through?

sinful tree
#

Remove the get controller. Shouldn't need it anyway.

dusty radish
#

oh yeah i see the ref to self.. thanks

dusty radish
verbal tendon
#

What's the other issue?

dusty radish
#

hmmm thats it, how do you get around that?

verbal tendon
#

Think of blueprints this way

#

A blueprint runs on an instance of an actor that exists in the world

#

(self) is always that actor

#

it just changes execution context between client/server when you pass through events/RPCs

dusty radish
sinful tree
#

Whats the other issue?

dusty radish
#

when the function is called the item is removed from the inventory correctly on the server side, but on the client side it removes the item from the server

dusty radish
sinful tree
# dusty radish when the function is called the item is removed from the inventory correctly on ...

This statement doesn't make a lot of sense. If you have an inventory that is replicated (eg. the component itself is marked to replicate & the the variables storing the actual contents of the inventory are marked to Replicate) any changes made to the inventory variables on the server should replicate to all relevant clients, so long as those variables are don't have any replication conditions set on them.

dusty radish
cerulean hamlet
#

Is ServerTravel with a client and server supposed to work in PIE? Only my server is travelling

#

It seems like my client's connection is getting closed?

dusty radish
# sinful tree This statement doesn't make a lot of sense. If you have an inventory that is re...

I'll try explain the issue a little better. The issue is that if you (host) have the required resources and build something then your resources get used. If I (client) build something It checks my inventory for the appropriate amount of items and then once I build the item successfully this function runs and removes the items from the player. This is getting the server host though so the host loses the resources when the client builds something

sinful tree
# dusty radish I'll try explain the issue a little better. The issue is that if you (host) have...

Won't be able to advise any further with the images provided as it depends on how/where the event that fired that is causing this "Remove Items From Inventory" function to execute.

As it stands, you are calling it from a self reference of "BP EBS PlayerController". That means anything you're manipulating is on that particular instance of the "BP EBS PlayerController" - when you execute that "Run On Server" event from the "BP EBS Player Controller" using a reference of self, it'll specifically be referencing that instance as well. So if you are calling this on the hosts copy of "BP EBS PlayerController" then everything else with a reference to self will be in reference to the host's copy.

If you're consuming resources while trying to build something, normally a Run On Server event would be called from the player controller or character asking to place the item on the server, and it subsequently remove the required items from that player's inventory. Since this would be running on self, then you would know who it originated from even on the server. Your issue could be stemming from the fact that you used Get Player Controller 0 or Get Player Character 0 somewhere earlier in the chain of events and calling functions on that reference while already on the server.

kindred widget
dusty radish
sinful tree
# sinful tree Won't be able to advise any further with the images provided as it depends on ho...

So it should go something like:
BP EBS PlayerController Event that triggers the placement of an item > Place Item (Run On Server Event), Probably with inputs for location & item type > Server event verifies placement of item is valid, verify player has required items & any other checks > Server places item & consumes items from the controlled pawn of the BP EBS Player Controller that placed the item.

#

There really should be no need to get a reference to a specific player. If you need to move the code into a different area, you can pass in a reference to "self" as the player controller calling the event.

dusty radish
sinful tree
#

What comes before this?

dusty radish
sinful tree
#

What calls that BPI?

dusty radish
sinful tree
#

Ok, so lets follow the Complete Upgrade - where is that called from?

dusty radish
dusty radish
dusty radish
sinful tree
#

Ok, then how about the Complete Repair?

dark edge
#

Pawn or PlayerController should be doing the building and Pawn or PlayerState should hold the resources

dusty radish
dusty radish
dark edge
#

Back up and start from the ground floor. So the building logic lives in the PlayerController and data (inventory) lives in the possessed Character right?

dusty radish
#

correct

dark edge
#

That sounds fine. So for anything involving resources, it should flow like this

Input -> LOCAL resource check on MyCharacterRef(can omit) -> Run on Server Event

Run on Server Event -> resource check on MyCharacterRef -> resource deduction on MyCharacterRef -> DoThingToBuilding

#

Both resource checks are the same function

#

Just run it locally before trying to send RPC and can play error sounds etc

#

The important thing is that the player controller doing the calling is talking to its character. Not get player character, not player Pawn 0, but the controllers character.

#

Get player character and the like will return the HOSTS pawn on the server, which is the root of your problems.

dusty radish
#

i've been looking at all of this for most of the day before talking to anyone on here and it all makes sense now

#

thank you both for your patience!

#

and help!

dusty radish
dark edge
#

No problem.

#

Uhhhhh

dusty radish
#

i'm not even sure how to be honest

dark edge
#

Yeah it's definitely not working.

dusty radish
#

yey!

sinful tree
#

lol

dark edge
#

Somehow somewhere there has to be an RPC between the client and the server for the server to know anything.

dusty radish
#

should i post a short video of it working?

dark edge
#

I'll be home in a few and can do a stream if you want.

dusty radish
#

sure that would be great

dark edge
#

I'll pm when I get home.

dusty radish
#

sounds good

sinful tree
#

I said this the other day to someone... The appearance of working, and actually doing what you expect is two different things.

dusty radish
sinful tree
#

Especially so with multiplayer.

dusty radish
#

I've been using UE4 for a long time now and only just started doing multiplayer stuff but I think its both brilliant and terrible

dark edge
#

I've been working with it off and on for like 7 years and started out with multiplayer day one, but I knew absolutely nothing coming in. Learn new stuff everyday

dusty radish
#

I take it you remember paying for unreal too?

dark edge
#

Yep. I actually got a refund when it went free

#

I started like the day it came out

dusty radish
#

that's pretty lucky I think it was just as my second payment one came out and I got the refund for the latest one

dark edge
#

@dusty radish PM me, I can't PM you

bitter comet
#

Hey all, does anyone know what would cause some users to be able to see Steam sessions but some players are not? They are all using the same build, they are all signed into Steam, but for some reason 1-2 people are able to see and join the session out of 8 possible

severe nymph
#

@bitter comet regional manager that the steam subsystem uses

#

It’s part of the steamworks sdk documentation

#

I think it can be overridden but you likely don’t want to

#

As it would cause really bad performance

#

Usually latency is too high between the listen server session and the client

#

The only other reason is the nat type limitations from host within a network hosting from a wifi connection

#

Closed nat type routers have difficulty at times communicating with other closed nat type connections

violet sentinel
#

what are the preferred ways of making tracking events when player posesses / unpossesses pawns?

my current is: server side PC::OnPossess calls a client PC::ClientPossess which triggers Multicast delegate but there are cases when PlayerState not up to date yet
alternative ticking controller checking for client player state & playerstate pawn and trigger multicast delegate
in UE5 there is a delegate in PlayerState that triggered when pawn posessed but i'm still on UE4 😦

vagrant grail
#

I'm back again for my timer, my timer is wrong, at 10 AM it considers that as Night and goes faster and I don't understand why 😦

peak sentinel
#

Ah sorry it was on PC

#

You can try ClientInitialize() though

chrome bay
#

They took my delegate PR then 😄

violet sentinel
chrome bay
#

The controller client yeah

#

not others ofc

violet sentinel
#

i'm thinking on making some delegates for ui to subscribe

#

didn't find a better way as some ui sections have to be hidden when no active pawn or swap when possession changes to another type

chrome bay
#

yeah, I use the controller::SetPawn then notify the HUD from there

#

then hud does whatever it wants

winged badger
#

there is also an engine delegate on the PC for when it gets the pawn

#

i think

slim mist
#

Hey y'all, on an ACharacter, if you had one person responsible for it's CMC movement, and another person responsible for moving the end effectors for it's IK driven arms, what do you think the optimal relationship would be between the ACharacter and the two players? Obviously client side prediction is a big thing with this because both players are adjusting the position in a way

azure hollow
#

Hey, I am uploading my build on Steam to test the game internally and I got this
"An error occurred while updating _______ (invalid app configuration)"
Is this error happening because of some wrong uploading process I did or what? I tried to run as admin or verifying integrity of game files and stuff but apparently is not working (my store page in not released yet I don't know if this can cause any issue it's my first time with Steam) Thanks!

vague fractal
thin stratus
#

They even uploaded the page with my name and company

#

uff

#

Send them a support message :P

dark edge
#

@thin stratus

Sounds like somebody might be entitled to compensation

thin stratus
#

I just don't want them to host something that needs to be paid, while it's available for free

#

But I also have no clue what CourseHero is

#

Just send them a friendly reminder that it's free. Can't really send a takedown notice anyway

vague fractal
#

I've got here a problem where i'm unsure what the problem actually is. (That's not the full code, but it should come down to this)

void UPlayerInventorySystemComponent::Server_DuplicateItem(UItemData_Base* ToDuplicate)
{
    const auto& DuplicatedItem = DuplicateObject(ToDuplicate, this);
    InventoryItems.Add(DuplicatedItem);
}

The inventory system component itself is replicated just as the InventoryItems (Which is an TArray<UItemData_Base*>).
The duplicated item is valid on the server, but not on the client as the new element in the array will be an nullptr

Kinda feel like it's a simple thing i'm missing here 😅

#

Not sure if it's important, but UItemData_Base extends from UObject

chrome bay
#

UItemData_Base needs to be replicated somehow for that pointer to be valid

#

(Or stably-named i.e., an asset)

vague fractal
#

I'll try that, thanks

chrome bay
#

Some actor needs to be replicating them as sub-objects, essentially

vague fractal
#

I feel like i've did it correctly, but it's still not working.
Can it be by any chance that it's happening cuz i'm using DuplicateObject rather than e.g. NewObject ?

buoyant viper
#

Anyone know why my static mesh won't move up and down with the player camera when not on the client running a listen server?

Component replicates is enabled on all the components there and movement replicates also is enabled. Everything else replicates fine but the up/down movement of this static mesh. Rotation seems to work fine for the host though (Host is on the right of that gif)

https://i.gyazo.com/dee94e7bf7326f84ddd853a04cdc07be.mp4

slim mist
#

Am I crazy or does a dedicated server not simulate a skeletal mesh at all? I have the transform of an end effector for arm IK in the animation blueprint for a skeletal mesh, and all networked clients see the arm properly moving - but the dedicated server itself does not see the arm moving. I am validating this by logging the position of a gun that is attached to the socket on the hand.

trim kindle
#

Is there a way how to disable replication but only for owning client and not for simulated proxies? The best I can think of is duplicate the property, give it different replication conditions and disable the one replicated to owner when needed. (Trying to prevent ammo replication while the weapon is shooting, so that received ammo values won't be fighting with local prediction. Other players still need to be able to see your ammo count.)

slim mist
trim kindle
#

That would work but I am not sure if I want to allow client to tell server how much ammo he has 😅

dark edge
sinful tree
digital mango
#

Would a replication graph be the way to go if I wanted to "hide" actors from certain players' client, or is that just for network optimization? If so, what should I be looking into?
Like in an RTS, if the unit isn't revealed/visible to a player's units/structures, their client shouldn't know anything about it to prevent cheating.
Sorry if it's a dumb question, just getting into MP.

low helm
#

I don't know if I'd be too worried about cheating at this early stage of your work.......though yes you could use replication graph to achieve this

Related, you should strongly consider not making an RTS in Unreal, because doing so requires extensive networking, movement, and navigation custom optimization which almost nobody does

#

I am working on a top-down RTS style game but with very few units-per-player

#

If I were you though, I'd just let the building network itself in and out and use radial BP logic to trigger its visibility

#

which is vulnerable to cheating but who cares

digital mango
#

I'm not that worried about cheating, just wondering what systems/terminology I'd need to read up on to get it done in future.
doing so requires extensive networking, movement, and navigation custom optimization which almost nobody does
Because the systems are that expensive, or just that nobody wants to do it? lol

hollow eagle
#

network relevancy

#

that's the "basic" way to do it

#

replication graph might also be able to handle that but it's a more complex system.

digital mango
low helm
#

older games like Age of Empires use an ancient technique of simultaneous simulated networking which has been lost to time

#

in those games, clients just send move orders to each other, and every client issues everybody elses move orders to his local units and they all perfectly synchronize in acting out those orders

#

There are some dark wizards who have worked tirelessly to create systems of network bundling in Unreal, where all the location updates of all the units are compressed very efficiently and sent in one very efficient update every (server) frame over the network, but they keep their secrets well guarded and will extract a high price if you seek their knowledge.

#

(I've estimated under normal conditions for an RTS in Unreal, you can get between 100-150 moving units going at a time before net bandwidth begins to struggle, this is all moving units in the game, so in a 10 player game each player would have no more than 10-15 units and even then not very responsively)

hollow eagle
#

That assumes everything is constantly being replicated to everyone, though. Which is exactly what systems like replication graph are meant to fix.
Not saying that massive-scale RTS are a good idea with unreal's built-in replication system but 100-150 moving units being bandwidth-limited seems suspect.

#

I'd expect that to be more of a server perf (cpu/memory) issue than bandwidth.

#

At least if you're using CMC or similar.

low helm
hollow eagle
#

Sure, but they don't all need to be updated in realtime to every player.

low helm
#

Yes CMC is to be avoided as well

#

in major battles they would, based on how most RTS work

hollow eagle
#

Sure, because very few RTS use the sort of replication unreal does. But there's quite a bit of leniency you can get out of units you don't directly control.

low helm
#

true

hollow eagle
#

Which means network update rates can be massively lowered on everything else.

#

As long as the game looks mostly consistent it isn't going to matter.

low helm
#

wellllllll.......players expect alot of networking precision if the RTS is competitive

#

that's why it'd be much easier to make a cooperative (not PvP) RTS style game

#

which I am doing

digital mango
#

Is Net Update Frequency an setting that can change dynamically, or is it set it and forget it? RTFM, seems able to be changed

low helm
#

If you're new to networking, I suggest you look into the Smooth Sync plugin

#

it will save you some big headaches once you finally decide to take the leap and stop using Character move component (CMC)

#

because without CMC you will need an interpolation solution to smooth out those slow server updates

#

and smooth sync is ideal for that and free

#

and even has a Client-Authoratitive option for movement which I rely on extensively for nice responsive movement

digital mango
#

I'll check it out. Not new to networking, just UE networking

#

Appreciate the help though, I'll have to do some reading

low helm
#

so look into that

digital mango
#

Yeah thats on the reading list. That'll probably be a necessity for optimizing, but I was thinking that combined with net relevancy for finer grain would be reasonable. I'll have to do some perf testing

low helm
#

whats your target total-simultaneous-moving actor count?

quasi tide
#

This?

low helm
#

yeah

quasi tide
#

It ain't free

#

lol

low helm
#

oh, well it was free for a month

#

a must have IMO

#

unless you want to sit there and write your own

#

but it's got the bells and whistles

deep shore
#

I purchased smooth sync in hopes of fixing the spectator camera for my game…it improved some things but also introduced problems i didn’t have using CMC

digital mango
low helm
#

I'll get the dungeon ready

digital mango
#

lol

quasi tide
#

Yeah, plugin looks neat. Even for $20 honestly.

#

But I have no need to not use CMC currently.

shrewd violet
#

I have a C++ NetMulticast func in a Component that fails occasionally

Meaning that some days when i run the project, the client just fails silently to receive the RPC. If i test it by calling it in Blueprints, I will get an error linking that BP Func node (at least I get an error in BP)

  • Re-compiling

  • Changing the C++ code and Re-compiling

  • Restarting UE4 and IDE
    All the above does not fix it

  • Deleting Binaries and Intermediates
    This fixes it

But why does it keep happening :/ and at this particular code and function.
I'm reading through the Network Compendium now to see if there are any ahas or gotchas i've missed. Am I using RPCs wrongly, is it not meant to be called in a component?

chrome bay
#

Should be working fine but I would first check that the array isn't exceeding the maximum data size, and also that hte object is network relevant when the RPC is broadcast

#

If an object isn't relevant to a client when that RPC is called, they'll never recieve it

winged badger
#

recompiling wrong binaries would also explain it

shrewd violet
#

Ah ill keep that hot reload in mind and see if it still occurs, thanks!

winged badger
#

with time period being "some days" i doubt that you never closed the editor and recompiled

past seal
#

Do you guys now any way to store individual player information across levels? I've been told that gameinstance is the only persistent actor across levels.

winged badger
#

PlayerState in combination with CopyProperties and SeamlessTravel

#

@past seal

#

SeamlessTravel is recommended way to transfer between levels

past seal
#

So i can use the same playerstate for both levels then copy the properties somehow?

buoyant viper
winged badger
#

you make a base PlayerState class that all your PS classes derive from

#

and you put members holding the persistent data into it

#

you also implement CopyProperties in the base class to copy that data from old instance to a new one

#

by the time GameMode calls HandleStartingNewPlayer for the player (which engine uses to spawn the PlayerPawn) that data will be available, even if the PS class changes between levels

#

and you should use HandleStartingNewPlayer, and not PostLogin, as PostLogin does not work for seamless travel, while the former works for both login and seamless

winged badger
vague fractal
#

I got those warnings here

Warning      LogClass             Property InventorySystemComponent::bReplicates (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.
Warning      LogClass             Property InventorySystemComponent::bIsActive (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.
Warning      LogClass             Property PlayerInventorySystemComponent::bReplicates (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.
Warning      LogClass             Property PlayerInventorySystemComponent::bIsActive (SourceClass: ActorComponent) was not registered in GetLifetimeReplicatedProps. This property will not be replicated. Use DISABLE_REPLICATED_PROPERTY if not replicating was intentional.

But it's alright, right ?
Cuz i don't think i ever saw someone replicating bReplicates or the others

kindred widget
#

Never had that error, but it almost looks like there was a super call missed.

violet sentinel
vague fractal
#

Yeah.. forgot the super call in my UInventorySystemComponent 🤦‍♀️

tidal swan
#

So I'm trying to interact with a 3d widget with a Widget Interaction component, starting from the Collaborative Viewer Template.
I can't seem to be able to click the 3d widget on the client. My custom hit is ok on the client-side but the "Press Key" isn't actually clicking the UI. Any ideas on what I'm missing? It's probably something really stupid that I forgot :q

This is called when I click (non-VR) or point-and-trigger (VR)

quasi tide
sinful tree
#

Yes. PostLogin is before HandleStartingNewPlayer

quasi tide
#

Good to know, I've been relying on PostLogin for my setup needs. Haven't gotten to seamless travel yet.

winged badger
#

2 things call HandleStartingNewPlayer

#

PostLogin, and HandleSeamlessTravelPlayer

#

its BlueprintNative, unlike PostLogin which is BlueprintImplementable

#

and c++ _Implementation is what calls RestartPawn which by default Spawns DefaultPawnForController

#

_Implementation being AddParentCall

#

from BP

quasi tide
#

Awesome Possum. This is great to know, went ahead and just changed my setup to use that instead of PostLogin. Even gives the controller, so that's nice.

snow turret
#

I've found an issue, whenever I fail the pounce attack as a client (which is meant to send you into a cooldown animation- which is fully functional on Standalone) it sends to "set movement mode" node to the server. I want it to trigger for the client, but it automatically sends to the server and punishes the host instead. Could this be something to do with the "Get Player Pawn"? Or maybe the cast? Or should I use something else instead of the Set Movement Mode?

#

I've tried setting the Max Walk Speed to 0 but that allows the player to spin in place

sinful tree
#

Don't use Get Player Pawn in anim BP. Use TryGetPawnOwner.

snow turret
#

OH MY GOD

#

YOU JUST COMPLETELY FIXED MY ISSUE IN ONE MESSAGE

#

What a live saver! Thanks so much!!

flat pendant
#

I want to make it so that when a client hovers over an actor in the world, it changes its appearance for only the client that hovered.
Inside of this character, I have it so on BeginPlay it binds OnBeginCursorOver and OnEndCursorOver to the character's Capsule Component.
In OnBeginCursorOver, I set the widget text to something, and OnEndCursorOver I set it back.
As you can see in the video, it works for both of the connected players to hover over each other's characters, however it does not work on a character that was already placed in the world. I can't figure out why.

twin juniper
#

show code 😄

flat pendant
#
void AVCharacterBase::BeginPlay()
{
    Super::BeginPlay();

    GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block);
    GetCapsuleComponent()->OnBeginCursorOver.AddDynamic(this, &AVCharacterBase::OnMouseEnter);
    GetCapsuleComponent()->OnEndCursorOver.AddDynamic(this, &AVCharacterBase::OnMouseExit);
    GetCapsuleComponent()->OnClicked.AddDynamic(this, &AVCharacterBase::OnMouseClicked);
}

void AVCharacterBase::OnMouseEnter(UPrimitiveComponent* TouchedComponent)
{
    FString HoveredName = FString::Printf(TEXT("- %s -"), *DisplayedName.ToString());
    LocalPerformSetDisplayName(FText::FromString(HoveredName), false);
}

void AVCharacterBase::OnMouseExit(UPrimitiveComponent* TouchedComponent)
{
    LocalPerformSetDisplayName(DisplayedName, false);
}

void AVCharacterBase::LocalPerformSetDisplayName(const FText& NewName, const bool bOverwriteActual)
{
    PerformSetDisplayName(NewName, bOverwriteActual);
}

void AVCharacterBase::PerformSetDisplayName(const FText& NewName, const bool bOverwriteActual)
{
    if (bOverwriteActual)
    {
        DisplayedName = NewName;
    }
    Overhead->Nametag->SetContents(NewName); // simply sets the text contents of the widget
}
tawny nova
#

kind of a wild guess, but maybe: GetCapsuleComponent()->SetCollisionResponseToChannel(ECC_Visibility, ECR_Block)

#

maybe the collision response is not set for the objects that were already placed?

#

maybe nothing in the BeginPlay() gets run for them at all

flat pendant
#

I have log messages at each function and they do print when hovering over that object placed in the world

tawny nova
#

hm!

flat pendant
#

I probably need to re-think where I'm calling these functions based on ownership. I didn't think it would matter for a client-side effect but I am probably wrong

tawny nova
#

i'm pretty new myself, sorry

verbal tendon
#

because as you experienced for actors that already exist it wont work due to it not being networked ( I can't confirm this cos I'm knee deep in something else right now )

#

but the basic logic you can apply is to check on the character's beginplay that it is the local player, and then go over all those actors you want this enabled on and set it then

fathom aspen
#

Is there any way of getting a client player controller of one client on another client?

sinful tree
#

You can use the pawn or playerstate reference of a player and pass it to the server, and the server can do what it needs to with the player controller associated to the pawn or playerstate.

fathom aspen
#

Gotcha, thanks!

vague fractal
#

Got here a small problem which is probably related to the amount of time which it takes to replicate things down to the client.

I'm dropping an item (Server side) and i want to update the inventory on the client directly after the drop, but the client will still have the old amount.
It will be updated when i manually click the "Update inventory" button in my UI, but it's pretty weird that you'd have to do that manually.

I've already tried to OwningActor->ForceNetUpdate() before updating the inventory, but that will also not work, any ideas ? 😅

#

For now i'd just update it like here as it seems to work, but it feels rather dirty. Not even sure if that's a thing i should do tbh 😅

FTimerHandle UpdateInventoryHandle;
const auto& UpdateInventoryDelegate = FTimerDelegate::CreateWeakLambda(this, [this]()
{
  Client_UpdateInventory();
});
GetWorld()->GetTimerManager().SetTimer(UpdateInventoryHandle, UpdateInventoryDelegate, .1f, false);
sinful tree
#

Why not have your inventory replicated VIA RepNotify? When the server changes the value, the repnotify would fire on the client when it's received the update and you can use that event to drive changes to any UI etc.

lean surge
#

Hi so I have a repnotify function associated with a variable, yet it is not being called.
To break it down, a variable is being set server side (I have verified this happens) yet when it is changed the associated function is not being called. The variable is being used in GetLifetimeReplicatedProps and is declared as show below:

UPROPERTY(ReplicatedUsing = OnRep_CurrentHealth) // Has a UE_LOG on initial change of this variable through a function that is being called by the server
float CurrentHealth;```

UFUNCTION()
void OnRep_CurrentHealth(); // Has a UE_LOG that is not being called once the variable has been set```
Can anyone help me?

vague fractal
vague fractal
lean surge
vague fractal
#

Alright, cuz it wouldn't fire on the server as you'd need to call it manually in C++

#

Any chance that you've forgot to enable the replication on your owner or similar ?

lean surge
#

actually it was that, constructor wasn't being called to do that for some reason on compile
will definitely check that in the future, thanks

plucky prawn
#

so if i have 2 character pawns (eg the provide ThirdPersonCharacter pawn), if i call Player2PlayerController SetViewTargetWithBlend in blueprints, using Player1's character pawn, the camera for Player2 is now controlled by Player1. is there a way to stop this from happening so that Player2 can control the camera?

fathom aspen
#

Can I make a property that is not replicated in the father(engine class), replicated in the son(custom derived class)?

lost inlet
#

well usually it's just "parent" and "child", but what exactly are you trying to replicate from an engine class?

#

there's usually a good reason it's not replicated by default

fathom aspen
#

SpectatorPawn from PC

fathom aspen
humble knot
#

Does anyone know why my rpc _implementation functions are throwing intelisense eorros?```void ATicTacToePlayerController::Server_SetEOWNER_Implementation(TEnumAsByte<EOwner>,APieceSpawner *)': overloaded member function not found in 'ATicTacToePlayerController'

#
    void Server_SetEOWNER(TEnumAsByte<EOwner> type, APieceSpawner* in_spawner);
sinful tree
humble knot
lost inlet
#

you did not implement the Implementation function

#

also TEnumAsByte is some 2014 stuff unless this is a legacy engine enum

humble knot
lost inlet
#

I said implement

#

you must do this for all RPCs

#

declaring is optional

#

since UHT does this itself if you don't

#

WithValidation is also optional now btw

humble knot
#

oh well yeah I implemented it in the cpp

lost inlet
#

show code then if it's not working

humble knot
#

I ctrl + x. closed Visual studios and then ctrl +v when it opened back up and now it compiles....

#

oh well I guess?

lost inlet
#

I really doubt that did, but take the win I guess

dark edge
#

What's the dummy ez way to replicate some data for a World Subsystem, just make an actor to do it?

lost inlet
#

pretty much

#

world subsystems can't replicate on their own

rotund onyx
#

Hi, I need players to download the host's save when they login to a server. These saves can be quite big and give me that max size error if I try to just replicate them. I can't find what method I'm supposed to use to transfer large data, does anyone know how?

sinful tree
#

What is it within the save that the clients need?

rotund onyx
#

mesh data and textures

hollow eagle
#

Your options are pretty much any one of:

  • Put that data in replicable objects with appropriate properties (not just a TArray of binary data that might be too big - I know this isn't always easily possible)
  • Chunk the data up yourself and send it via multiple RPCs
  • Come up with something outside the replication system. This could be anything from HTTP to custom TCP or UDP sockets. You're not really making use of the engine's networking aside from maybe the built in socket classes.
gleaming kite
#

Are blueprint interfaces replicated by default? Or do I have to rpc the message?

sinful tree
gleaming kite
#

gotcha, thanks. I was wondering why my bpi wasnt working

tawny nova
#

sorry for a newbie question - i'm following a tutorial and the first step is #include Net/UnrealNetwork.h but my autocomplete doesn't find it, and SetIsReplicated breaks the build because it's not found

#

so I see in the docs that maybe this moved to Components/ActorComponent.h but the build fails with that include also

#

is my IDE set up wrong, or is this tutorial too old to be useful, or... where should I look

leaden scaffold
#

#include "Net/UnrealNetwork.h" is correct

tawny nova
#

is it a clue that the visual studio autocomplete doesn't find it?

leaden scaffold
#

It's a core part of the engine

#

Are you missing the quotes as in your example?

tawny nova
#

right, so I am wondering how to check if I have something not setup right with vstudio

#

no, the quotes are there, the highlighting looks right

#

it built before i added it, it's a pretty clean from scratch c++ project

leaden scaffold
#

I think you should be using bReplicates = true

tawny nova
#

i just want to work through the tutorial to start, it's OK

#

i was worried that maybe it was too outdated though

leaden scaffold
#

Maybe close the editor and rebuild

tawny nova
leaden scaffold
#

SetIsReplicatedByDefault is preferred during Component Construction

tawny nova
#

but to follow the tutorial, just how do i import that particular function correctly?

#

i get it, i'm just trying to follow along though

#

and am stuck on literally the first line

leaden scaffold
#

how did you create the class

tawny nova
#

we right clicked in the editor and did 'create c++ class'

#

and then vstudio detected that it was added and did some compiling

leaden scaffold
#

if you selected actor component as the class, it's already imported

#

otherwise from a different parent class what you posted would work

tawny nova
#

hm

leaden scaffold
#

#import "Components/ActorComponent.h"

#

just because auto complete says its wrong doesn't mean it is

#

what does the compiler say

tawny nova
#

identifier "SetIsReplicated" is undefined

#

ok, thank you though, it helps me rule out some obvious things

leaden scaffold
#

can you post the code around it

tawny nova
#
{
    Super::BeginPlay();
    SetIsReplicated(true);
    
}```
#

there's no code, it's just added that single line so far

leaden scaffold
#

oh yeah

#

you made an actor it looks like

#

not a component

#

what's the header for APlayerStats

#

the A is the clue

#

it should be U

tawny nova
#

okay

leaden scaffold
#

AActor does not have that function

#

you use bReplicates

tawny nova
#

no, i'm going to use what the tutorial uses.. thank you, that was it

leaden scaffold
#

👍 glad it helped

plucky prawn
#

is there a good way to replicate a map? ive read that i could use a TArray but .. im using a map to guarantee unique keys which i cant do with a TArray

sinful tree
# plucky prawn is there a good way to replicate a map? ive read that i could use a `TArray` but...

Maps can't be replicated. Closest you can do is use an array of a structure with your key type and your value type and having functions set up to add/remove/find items from the map that search for the key within the array structure. You can also simulate replication of a map by having the map exist on both the server and client and update it on both VIA RPCs (ie. sending the key and value through the event) but that's only useful if you're working with actors that are always relevant otherwise the clients will go out of sync.

dark edge
#

I could use an edge list instead of adjacency list, then it'd be a single array of up to 15,000 or so tuples of pointers or GUIDs

dark edge
#

so it'd just check MyStruct.Key for equivelency

gleaming kite
#

Any reason why that when setting a rep notify array's elements, the rep notify runs on everything but the dedicated server (only the clients)? When completely setting/overwriting the array, everyone gets the rep notify including the dedicated server.

leaden scaffold
#

RepNotify doesn't run on server because it doesn't replicate to itself

dark edge
gleaming kite
#

ah ok, typical bp buggyness

#

thank you!

dark edge
#

I think it's just to be helpful. Honestly I'd prefer it as it makes it easy to make things state driven everywhere

gleaming kite
#

Yeah I think it makes more sense, what doesnt make sense is why only some edge cases replicate to the clients only

dark edge
#

They really oughta bring the 2 up to parity and choose one approach.

gleaming kite
#

Definitely

twin juniper
#

That’s what I heard from Epic

kindred widget
#

Random fun fact about that BP RepNotify. That is actually the Set node. You do not get the same affect when doing a ++ on an integer for example.

thin stratus
gleaming kite
#

Im getting really beaten down by rep notifies tonight but why do array rep notifies not run on the client when you are using a custom actor class? Non arrays rep notifies to all clients just fine on custom actors but once its an array, it doesnt work?

#

hard to explain but when i use a replicated array on my first person char, it runs this code fine

#

but when doing the same on another class (Its set to replicate and is being set by the server), it only prints from the server, never the client

gleaming kite
#

well i put my functionality on the game state and it all works. Just really wish bps werent half finished/implemented

kindred widget
#

They work fine. Chances are that your actor wasn't relevant?

#

If your actor was just a scene component, it won't register as relevant to a client.

rough jolt
#

I am having some issues with replication in my ue4 dogfighting game. The guns replicate, in the editor it all works flawlessly, but in actual multiplayer their source seems to lag behind the aircraft that fires them. Can't really figure out why

#

as you can see the other ship is firing, but the lasers aren't coming out of it, but rather from nearby

#

the lasers are physical objects being spawned from the muzzle of the ship

silent valley
#

@rough jolt welcome to multiplayer 🙂 I advise testing in editor with Network Emulation set to Avg at least at all times, then you should see the same problem in editor at least.

By the time the fire RPC comes through, the remote player is no longer in the place they were due to prediction. A common way to handle this case is to fire the shot from the current remote player location and lerp towards the correct flightpath over a short time period.

rough jolt
silent valley
#

similar issue. a lot of games like this use client side authority for shooting, so that the client always sees their own bullets correctly.
Client sends a message to server saying I fired from X location in Y direction, and spawns it's own bullet so it looks correct.
Server receives the message and can either spawn a bullet and fast forward it based on the round trip time, or just replicate the message to other clients and allow the firing client to handle collision.

jolly siren
#

I'm spawning some non-replicated actors on both the client and server independently and then calling SetNetAddressable() on them on both the server and client. However, when I do this I get a lot of log spam on the client. Does anyone know how to avoid this?

#

I get that spam until the client finishes spawning those actors

#

@winged badger I think you have the most experience with this?

winged badger
#

also, you shouldn't turn replication on until client has spawned them

jolly siren
#

I'm not specifically doing anything with the name. I only get this log spam until the actor spawns on the client though.

#

I'm not turning on replication at all

#

These are for actors that have IsReplicated set to false

winged badger
#

if its NetAddressable

jolly siren
#
AActor* const Actor = GetWorld()->SpawnActorDeferred<AActor>(ClassToSpawn, ActorToSpawn.Transform, nullptr, nullptr, ESpawnActorCollisionHandlingMethod::AlwaysSpawn);

if (!Actor->GetIsReplicated()) {
    Actor->SetNetAddressable();
    if (GetNetMode() == NM_Client) {
        Actor->SetRole(ROLE_None);
    }
}