#multiplayer

1 messages ยท Page 619 of 1

winged badger
#

client doesn't have that information

mighty zinc
#

Character doesn't fall on begin play, im sure it's getting possessed.

When i start the game as the server, everything works fine but when playing as client i can only rotate it

It doesn't fall or jump etc

#

How can i fix this?

steady fox
#

I'm getting a weird issue with GetPlayerState() returning null in the character class, and I'm positive that the character actor still exists in the world. Does anybody know if there documentation on the lifecycle of PlayerStates or if there's weird quirks with it?

mighty zinc
mighty zinc
# steady fox I'm getting a weird issue with `GetPlayerState()` returning null in the characte...

What happens when you start up your Unreal Engine game? This video is a guided tour of the Engine's initialization process: along the way, we'll glimpse the high-level structure of the Engine (modules, game instances, local players, and viewports) and we'll see how all the different parts of the Game Framework (game modes, game states, player co...

โ–ถ Play video
steady fox
# mighty zinc Yes i tried that, didn't work.

Ah. Yeah, Hrm. I relatively new as well when it comes to UE, but I feel like I ran into a similar problem as when I was working on movement. Hm. I'm looking around to see if I remember what I did.

mighty zinc
steady fox
vague spruce
#

sup. so my game mode base is spawning my enemy on the server too quickly and whenever i have breakpoints set up in my code the enemy is at like -20000 Z on the transform. any way i can prevent that from happening? would love to keep using breakpoints and not have the server send my enemies into the abyss

vague spruce
#

is it possible to replicate a TMap?

potent cradle
#

StructArray is your best bet

#

Or, manually replicate the changes with an RPC

#

(i.e. send a key and value across the network, and update manually)

vague spruce
#

i believe i may not need to replicate this information as it's only relevant on the server, but this is useful information. thank you @potent cradle

marble gazelle
#

of course you can replicate a TMap, just need to wrap it and write your own replication code ..

potent cradle
#

"just" might be a bit of misnomer in this case, unless it's significantly easier to do than I know

#

Would love to see if you have an example though

#

I wonder why it's not supported in Unreal by default

chrome bay
#

Can't guarantee the keys will be available, especially if it's keyed with objects. It's quite a bit more complex, you'd likely have to replicate big chunks of it when pairs change etc.

#

So it would need some kind of complex wrapper anyway

#

It's best to just use a struct that wraps an array, and provide some helper functions

#

You won't ever be replicating a TMap that's large enough for the lookup times to make a difference anyway.

swift kelp
#

When I run my game in standalone mode with 5 clients dedicated server, each window runs at about 2 fps.
but if I have the window activated (and I can only have one window selected at a time) the game runs fine

#

any way to make all 5 clients run ok instead of just the one I have selected?

chrome bay
#

In Editor Settings there's a checkbox for "Use Less CPU When In Background" or something, it's enabled by default. Unchecked it.

vague spruce
#

at what point does it make sense to both do something on the client AND on the server? for instance, i have replicated properties for setting a combat stance for my player. does it make sense to just set it on the server and let the replication handle the rest? most of the time i've noticed that the client is a little janky when i do that because it waits for the server to tell it what to do, so i find myself writing SetCombatStance and ServerSetCombatStance often

pallid mesa
#

that's some form of prediction

#

ie: trigerring an action on your client using your client's state hoping that will match the server afterwards

#

so it makes sense as soon as you know what you are doing ๐Ÿ˜

eternal citrus
#

I don't understand, why isn't this working?

#

I am getting all players starts in my gamemode and saving em in a variable

#

then I am calling "get next free player start" and spawn my player

#

but it's not working and my players are spawning on top of each other

#

any help?

potent cradle
#

You're removing before you return

#

That might be it

#

Could store it in a local variable, and return that instead

#

@eternal citrus

eternal citrus
#

ooh

#

let me try

#

no, still spawning on top of each other

potent cradle
#

Oh, I see, try making this a local variable, the index

#

Then get and remove with the index you stored (still store the actual thing you want to return in a local variable too, before you remove it, though)

#

The point is, any pure function will be rerun for each blueprint wire that runs it

#

You have a random function there, it's getting a (possibly different) random item twice.

#

If that doesn't solve the issue, I'd debug what is actually in the array and what you get out each time

#

But running a pure function that returns a random value twice is a recipe for disaster if you expect the same result.

eternal citrus
#

ok

#

like this?

potent cradle
#

No

#

You're still removing the item from the array before you actually get it

#

^ Store the transform you get from the array in a local variable there

#

Then use the same index you store in a local variable to remove the index from the array

#

And return the result (the transform) that you stored in a local variable at the end of your function

#

@eternal citrus

eternal citrus
#

ok

potent cradle
#

Not sure if it will or will not cause an issue, but do a get for a copy, not a getter that gives you a reference

eternal citrus
#

is this right?

potent cradle
#

Yes ๐Ÿ™‚

#

Does it fix your issue?

eternal citrus
#

yea

#

thanks bro

glad sedge
#

Should overlaps ever be run on server?

#

or is it okay to run it client, then feed whatever comes out of that logic onto the server?

spark owl
#

could having widget classes have a reference to game state and get variables in text bind cause network to be less stable?

kindred widget
#

@spark owl That shouldn't affect network at all. It's just a client getting local variables.

pallid mesa
#

the server will be your patternoster

glad sedge
#

Not following

#

Sorry, the reference I mean.

pallid mesa
#

so overlaps run by default on client and server

glad sedge
#

If it's specifically replicated?

#

In this case, a component.

pallid mesa
#

I dont think it needs to be replicated no

#

so as long as its an asset you place in the map

glad sedge
#

hrm okay. That's weird I was getting a readout that it was just pinging on Client side, not server.

pallid mesa
#

you can check this out by adding an authority check afterwards

#

and you'll see how the overlap gets triggered in both, client and server

#

so server to client should be

#

never do client to server

pallid mesa
glad sedge
#

yeah that

#

's fine.

#

I'll check it out, thanks

pallid mesa
#

no problem dont doubt on pinging me if you still have issues with that

twin vault
#

After travelling from a match to the lobby with seamless travel, on the lobby gamemode beginplay i call GameState->MulticastUpdateLobby, but for some reason it doesnt run on clients... if i do something that forces lobby updating again then it works,
so im wondering if on Gamemode Beginplay every player should be already set up? or is there a delay?

glad sedge
#

@the vi thanks

twin vault
#

ah, i guess the gamestate is created and isnt yet replicated to clients

peak notch
#

is there a way to set a session name using blueprints?

#

for Android platform

ancient bramble
#

we are currently trying to make a real time multiple player game, players can connect to server map and play against each other... currently we are stuck at authenticating the player. basically we need restrict a player from entering the map if certain rules are meet.
any help is much appreciated!

sharp night
#

hi, does anyone knows if is possible to get a value (variable) that's inside a game instance of a specific client (player controller) from the game mode (in c++)? im using dedicated server.

winged badger
#

@ancient bramble with players hotjoining, your only options are PreLogin and options string for connecting to the server

ancient bramble
#

how would i go about doing that, is there any documentation or tutorial that i can follow?

winged badger
#

its literally one function in GameMode that handles authorization

#

so, no

#

ideally you don't want to player to try connect and fail

#

but rather a custom server providing "matchmaking"

#

that keeps up to date on the status of your runnign dedi instances

#

and players connect to that and clearly see where they can and can't join

#

anything less is not really acceptable for production

#

@sharp night no, unless you send it a client RPC that requests server RPC been sent back with the information

#

and you should definitely design your data so you don't need to do it

#

@twin vault you guess wrong

#

at least with GameState (not GameStateBase) the GameState controls the start of the match on clients

meager spade
#

i think he is using a multicast in GameMode beginplay

winged badger
#

GameMode starts the match, sets the match state on the GameState, and OnRep_MatchState in GameState calls DispatchBeginPlay on the world

meager spade
#

which is bad

#

also so im wondering if on Gamemode Beginplay every player should be already set up? or is there a delay? GameMode does not exist on clients and no,# clients will not be setup at this point @twin vault

winged badger
#

which gives you one very convenient guarantee - GameState and all its replicated variables exist on clients before any Actor on any client calls BeginPlay

#

which means, you just need a replicated LobbyState

#

and GameState can on its BeginPlay just update the lobby, no need to MC, no need to even have OnRep for initial state

twin vault
#

im calling from the gamemode's beginplay, a function to update the lobby which is in the gamestate AGameStateBase::MulticastUpdateLobby @meager spade

meager spade
#

yes but that will not work

#

BeginPlay is way too early

winged badger
#

however if you do let the server start play immediately (which you definitely don't want to do)

#

that MC will fail spectacularly

meager spade
#

GameMode beginplay is always called

winged badger
#

as no client will have a GameState

#

its not Kaos

#

the StartPlay is called

#

not BeginPlay

#

before the match state is ready to start

meager spade
#

i thought GameMode was excluded from DispatchBeginPlay

#

and explicitly called from work

#

world*

winged badger
#

its not

#

it does its initial stuff in PreIntializeComponents

twin vault
#

thanks

meager spade
#

interesting, never really bothered with BeginPlay in GameMode (not had any use for it)

winged badger
#

exception for game mode would just obfuscate the code more

#

and its not neccessary

meager spade
#

would not surprise me with UE4 tho.

winged badger
#

yeah, thats why i double checked ๐Ÿ˜„

steel fox
#

Is it normal that GetOwner()->GetInstigator() and GetInstigator() can be two different Instigators? Or I'm doing something wrong?

meager spade
#

ofc it is possible

winged badger
#

its unusual

meager spade
#

but its possible.

winged badger
#

and its usually a fuckup on your part on not setting instigators correctly

meager spade
#

GetInstigator on my weapon could be a different Instigator to my projectile for example even tho the owner of the projectile is the weapon.

#

but yea, you need to make sure instigators are set properly yourself, UE4 won't do that

winged badger
#

yes, technically, i can't imagine a paractical purpose for that

meager spade
#

no but its possible as UE4 does not enforce it

steel fox
#

I'm a bit confused with them, for what are Instigators needed exactly?

hollow bridge
#

Hi, does anyone know a workaround for repnotify for set array elem (blueprint)?

winged badger
#

@steel fox primarily for logging damage sources, scoring and analytics

#

also for stuff like making AI hate the instigator of the bullet that just shot it in the arse

dense ocean
#

Only on my client, backward and side movement jitters. Anybody experience this? It doesn't jitter from the server side

steady fox
celest sleet
#

I found what seems to be the issue in my project, (the client motion controllers not tracking), turns out for some reason it was using Game Instance Base instead of my Game Instance

weary badge
#

I'm having an issue after a servertravel, where the widget doesnt get created on the host (only) and the cursor also doesn't show.
It works fine for the clients.

Does anyone know about this ?

grizzled stirrup
#

Anyone know what the ``LogNetPackageMap: Warning: Long net serialize: 113.946404ms, Serialized Object Default__BP_SomeBP` warning means?

#

The initial replication is very heavy for an actor or something?

#

I was testing two standalone instances with the client in focus and the server not so maybe that had something to do with it

glad sedge
#

Sorry no idea

#

I reckon your guess is right though, that says to me it's taking too long to serialise and send.

dense ocean
#

I have an event in my character that calls an event in the character that is Run On Server. the run on server event will only execute sometimes, maybe about half the time and its always called from the same place. Any ideas?

grizzled stirrup
#

Is it "free" to call a Client RPC on the client

#

As in the same cost as calling a regular function?

glad sedge
#

Client RPC?

lost inlet
#

you should be able to call a client RPC function from the client without touching the networking layer

#

same with server RPC functions as authority

grizzled stirrup
#

Thanks!

#

Much handier than having to make extra functions and check if on client or if on server for certain things

#

Listen server logic can get really messy as sometimes the player is the server and sometimes not, so this cleans it up nicely in some cases

glad sedge
#

ah

crystal crag
#

@meager spade Did you ever get your question answered by epic that you asked during last week's live stream?

#

It was regarding the ranged asset type

pallid mesa
#

what was it?

brazen sluice
#

Helloooo

#

Here's my current workflow, an actor gets spawned/replicated, and then a mesh gets geenrated
It works fine but the issue is that depending on the client connecting, the pink park (mesh part) sometimes happen before replication
Cause the client to not have the mesh infos available (it's a multicast on the server that sends them)

#

So I thought I wanted something from the client to notify the server that they need a mesh
BUT since the response is multicast
It will cause all the clients to update
Rather than only the interested one

#

So my question is, is there some kind of ... "ReplyToTheRetardClientOnly()"

peak notch
#

is there a guide or a tut on how to integrate google play with unreal engine so we can have player name and other accounts linked to there googleplay acount? basically sign in and stuff

marble gazelle
# brazen sluice

you could use a replicated property instead, this will be send with the initial bunsh, you also can modify what is send by the initial bunsh, checkout AActor::OnActorChannelOpen

brazen sluice
#

I have a feeling a replicated property would be inneficient

#

Because it's quite a heavy array

marble gazelle
#

why

#

does it change over time?

brazen sluice
#

That's why I replicate it only when it's necessary

#

Yeah it does

marble gazelle
#

you could write custom replication, you know that?

brazen sluice
#

As in trigger it manually only ?

#

or

marble gazelle
#

no, if it is replicated, it gets updated by a tick, but you can add a quick fallthrough to do nothing, if nothing changed, or is initial bunsh

brazen sluice
#

But the isssue is that, in order to check that the replication still has to happen

#

And this is going to send 50kb data throught the network for nothing

marble gazelle
#

you also can do: set the propety to replicate only in the initial bunsh and then update via RPC

brazen sluice
#

But isnt the client going to ping for updates and shit I am not quite sure how it works

marble gazelle
#

no?

brazen sluice
#

Oki

marble gazelle
#

the server decides when and what to send

brazen sluice
#

okay

#

What prop to only send initial value ?

marble gazelle
#

... do some code search ... xD sec, need to look

brazen sluice
#

Thaaanks sorry to bother you ๐Ÿ˜„

marble gazelle
#

checkout ELifetimeCondition

brazen sluice
#

cheers

marble gazelle
#

and then use it with DOREPLIFETIME_CONDITION

brazen sluice
#

I was trying to put it in UPROPERTY

#

UE was not happy

marble gazelle
#

na, you need to specify it in the GetLifetimeReplicatedProps

brazen sluice
#

cheers

nocturne iron
#

How do i replicate variables on UActorComponents in c++?

chrome bay
#

Same way as an actor

#

The component itself must also be replicated, and the actor

nocturne iron
#

Oh, i forgot the set the replication from the owning actor...

chrome bay
#

Yeah components replicated through their actors, so the actor also has to do it

crisp drum
#

epic mentioned in one of their network optimization live streams that it makes sense to have separate actor holding some of the replicated variables so that we can tune net update frequency & activate dormancy more appropriately/targeted, so i thought why not separate every mechanic's logics like for example a weapon pickup system into separate actors and attach them to my player character. im really new this, is this a bad idea guys?

chrome bay
#

It is yeah. You'll get a lot of data race conditions and general management will be much more difficult.

#

Not really sure why Epic would suggest that, it's not really that useful to do it.

crisp drum
#

hmmm gotcha

chrome bay
#

Also a danger of incurring a lot more CPU overhead with all those additional actors. Every actor comes with a handful of replicated properties already, so it's definitely not an optimisation

#

Where did they suggest that?

#

Keen to figure out what the context is

crisp drum
crisp drum
chrome bay
#

yeah

crisp drum
#

This week we'll be joined by Ryan Gerleve and Dave Ratti to discuss general server optimization in UE4, as well as techniques and solutions to improve your Actors' performance in a networked environment.

NEWS

Unlocking Breachโ€™s combat with Unreal Engine
https://www.unrealengine.com/en-US/tech-blog/unlocking-breach-s-combat-with-unreal-engine
...

โ–ถ Play video
#

15:27 if the time stamp didnt work right

#

idk if i understood him correctly tho

meager spade
#

all my weapons/items are actors ๐Ÿ˜„

chrome bay
#

yeah me too. I read this as "split of parts of my weapon logic into different actors" which def doesn't make sense to me

meager spade
#

ah that would be bad

chrome bay
#

@crisp drum While you can do it, I think it's better reserved for very particular situations. Just calling ForceNetUpdate() and dropping the overall frequency is a better approach IMO

#

fewer race issues, fewer actors etc.

meager spade
#

also make use of dormancy

chrome bay
#

yeah dormancy can also be super useful when used right

meager spade
#

that is the biggest optimization

#

^^

crisp drum
#

gotcha!!

chrome bay
#

The only downside of dormancy IMO is that when you re-open the channel it sends everything again, but for actors that only update themselves rarely - def a win

crisp drum
chrome bay
#

On a character you probably don't want low frequency anyway tbh

crisp drum
#

mmm how about one separate actor that holds all logic beside character movement? so that this could have low frequency

chrome bay
#

It's not worth the hassle IMO. Don't forget you're still only sending properties when they actually change

#

If the character has to do property-comparisons on the server at high rate anyway, it's almost certainly going to be less overhead to have a few extra comparisons on a single actor, than splitting it into two actors

meager spade
#

even push model does not reduce the cost that much

chrome bay
#

And it avoids a lot of extra code you have to write to keep those two actors in sync

#

yeah

meager spade
#

just get your priorities right

chrome bay
#

FYI in HLL we're using the default 100Hz rate for characters (100 of them), everything else is clamped down pretty hard though

meager spade
#

^ same in TRS2

chrome bay
#

great minds ๐Ÿ˜„

meager spade
#

characters always have highest priority also

crisp drum
#

wowie thank you so much guys!!! this cleared alot of stuff ๐Ÿ˜„

meager spade
#

@crisp drum thing is, this is fine tuning, and you can only really do this by profiling your costs.

meager spade
#

How many replicated actors you have? How many players? How many properties do those actors send? Is it better to use a RPC over a replicated property? etc

crisp drum
#

yeah that makes sense ๐Ÿ˜„

oak hound
#

hi, I'm creating multiplayer, for networking I'm using Advanced (Steam) Sessions plugin (project is mostly BP).
I wanted to add passwords to servers (listen servers), if someone wants to create publicly visible game, but wants to set up password.
I searched in google and source code, but can't find simple and reliable way to set this up.
Only solutions that I found is client-side verification (makes no sense) or modifying subsystem so that encrypted password is sent with join request and verified on PreLogin function in GameMode, so that server can decline connection.
Maybe someone knows simpler/better solution? Thanks in advance for answers.

chrome bay
#

That's a good way to do it yeah. What I would suggest is "Advertising" that the server is passworded via a server option, then when joining you send the (hashed) password to the Server that the client entered, and it compares. You can override virtual FString ApproveLogin(const FString& Options) override; in AGameSession to check the password string (likely a hashed string)

#

You can send it as an additional option on the join URL, you don't need to modify the OSS to do that

#

You never want the server to actually send the password to the clients, that's the important part

oak hound
chrome bay
#

Even in hash form

#

When actually joining a session you have to call Controller->ClientTravel(URL, TravelMode)

#

So you can just append the options to the URL

#

After calling Sessions->GetResolvedConnectString(SessionName, URL)

#

So you join the session, get the connection URL string, then ClientTravel to the server with the appended options.

#

If you're using beacons to handle the join stage you can do it without having to actually join the server and travel

#

But otherwise you need to "join" the server first to be able to send anything to it

#

I think we use SHA-256 ourselves, something like that

oak hound
chrome bay
#

We're using Steam too, you still gotta travel

#

IIRC it doesn't make you travel once you join

#

encryption doesn't really matter that much in this case tbh

#

Client already knows what the string is cus they typed it out

oak hound
#

ok, thanks for help ๐Ÿ™‚

vague fractal
#

Hey, i've got there a question about Multiplayer and testing.
My gf would highly like to test stuff with me, but i'm afraid that there's no way around doing a shipped version -> upload it -> download it -> test it
And that for every small change. Is it really that bad, or is there a way to avoid this ?
(Also, i'm doing a C++ project)

#

Can you explain that a little more?

#

Now i'm not sure what p4 sync means ๐Ÿ˜„

#

Ah, i see

#

I'm using Git with LFS

#

Alright, that seems like a lot better than the shipping and and method xD

#

But teaching my gf how to pull and co on the other hand xD

#

I actually do use github desktop and didn't had much problems with it so far

brazen sluice
#

is there a way to force ReplicatedUsing to be called even if the value is empty ?

marble gazelle
#

I'm not sure if I understand what you mean

brazen sluice
#

nvm I found REPNOTIFY_Always ๐Ÿ˜„ thanks Fri

marble gazelle
#

ah, cool ^^

brazen sluice
#

Hmm but it never says peepeepoopoo

marble gazelle
#

repnotify is only called, if smth gots actually replicated

chrome bay
#

yeah

brazen sluice
#

Hmm as in if the value is empty the initial rep doesnt happen at all ?

chrome bay
#

server has to actually send something

#

If the value is empty at serialization time, then yeah

brazen sluice
#

That's a bummer

chrome bay
#

Server assumes client has the same values

#

Just call it manually somewhere if you need to, e.g. PostInitComponents

brazen sluice
#

But I dont know when to call it

#

hmm

#

because client never knows if it is either in a state where it doesnt have the data yet OR if the data is empty

marble gazelle
#

actually you do have this information

chrome bay
#

What is commonChunkData() an array of?

brazen sluice
#

int

chrome bay
#

I'm not sure I understand the issue. All you gotta do is call registerClientChunk from some initialization point

brazen sluice
#

yeah but I shan't call it until i have data initilialised

marble gazelle
#

AActor::OnActorChannelOpen at this point you will receive the initial bunsh

brazen sluice
#

OnActorChannelOpen will be called after rep ?

chrome bay
#

Can also use PostNetInit

#

There's quite a few places

#

Still not really sure i understand the issue though

#

If the data isn't empty, then it's been initialized right?

#

Making some presumptions about what that array is ofc

brazen sluice
#

Yes but if the data is MISSING I shouldnt call registerClientChunk yet

#

only if it's meant to be empty

chrome bay
#

How can it be missing?

#

It's an array of ints

brazen sluice
#

As in the rep has not happened yet

chrome bay
#

So either the data is there, or it isn't

#

And it either has a .num() or it doesnt

brazen sluice
#

Not there are 3

chrome bay
#

It's an array of data, so you're guaranteed to receive the values at the same time as the size

brazen sluice
#

the data is non-empty and there, the data is non-empty but not replicated yet, or the data is empty (and will never replicate)

chrome bay
#

Rather than an array of pointers, in which case some pointers might be null until whatever they are pointing to also becomes relevant

brazen sluice
#

right now I cater for first 2

#

with onReplicate

#

but the last one does not trigger the hook

#

But just because the array size is 0 I cant assume it's meant to be empty because it might be that the replication is not finished yet

chrome bay
#

sounds like you need some sort of "bIsInitialized" state

brazen sluice
#

yeah may be I guess

#

If I have multiple props replicated are they consistent ?

chrome bay
#

Since I don't see anyway you can possibly determine that on the client otherwise

brazen sluice
#

As in they replicate at the same time

chrome bay
#

If they are in the same struct they replicate atomically

#

(i.e. together)

brazen sluice
#

fak

#

hmm

#

I guess i need a struct with {isReady, value} then

chrome bay
#

Just double checking is actor property rep is atomic too

brazen sluice
#

it seems to be tbh bc I have a position vector and so far it has never been missing

#

I have a log on it

chrome bay
#

Yeah but it might be than when saturated, it separates the packets. I don't think it does though

brazen sluice
#

let's try it

chrome bay
#

There are a few solutions it seems - you can override PostRepNotifies(), since the property is COND_InitialOnly, you can assume that if it's zero it will never replicate and is empty

#

Actually that sort of answer it - it's COND_InitialOnly, so the data will only ever replicate if it's been set to something non-zero anyway, and only ever in the initial spawn/open packet

brazen sluice
#

I actually set the onReplicate on the position vector

#

since it cannot be null

#

it always replicate

#

it works

#

And the replication seems atomic

#

At least in the editor...

chrome bay
#

You can't change the replication condition at runtime

#

It comes from the class-default object

#

Presumably that data never changes once the actor has spawned, so if anything you can just choose whether to add it to the manager or not in BeginPlay() or PostNetReceive()

brazen sluice
#

data changes but I manually notify at the right moment if necessary

#

so yes never auto replicates

chrome bay
#

Well as far as network is concerned at least, it never changes once spawned

brazen sluice
#

correct

chrome bay
#

So the rep notify doesn't seem necessary at all, just test it after the actor has been intiailized

#

Also, in times of packet loss - individual properties will replicate individually according to UDN, if I'm reading this right

brazen sluice
#

ahh ๐Ÿ˜ฆ

chrome bay
#

So it is possible to receive props at different times, but unlikely

brazen sluice
#

well sucks to be those clients

chrome bay
#

You can force a struct to be atomic by overriding NetSerialize()

brazen sluice
#

I guess the combination of empty data + packet loss if even more unlikely anyway

#

THanks will read up upon it

chrome bay
#

Shouldn't be a problem for a COND_Initial property since presumably it's sending all the data anyway

brazen sluice
#

ah oki thanks

chrome bay
#

but yeah ultimately a rep notify is only ever going to be called if the value is sent at all, and if a value matches the serialized value (at spawn time), it's not sent (for obvious bandwidth-saving reasons)

brazen sluice
#

I'm planning to change the generation to happen on client anyway at some point and only let server overwrite existing data rather

#

Just so that it's a bit faster

#

so all that wont be an issue anymore

#

I guess

#

Well it could still be if the client generated something in an array meant to be empty so i guess it's still good it's out of the waay

stoic nimbus
#

Hi ! I'm trying to use FRootMotionSource to predict my moves client side (using code from the gameplay ability plugin), but I have a weird glitch when I add some lag with pktlag (using 500ms), it looks like the root motion is being played a second time then rolled back

#

Root motion with prediction + RPC, client on the right

rich ridge
stoic nimbus
#

no, I mean I play the root motion locally and send the same one on the server, this is using CharacterMovementComponent

#

but I've used the network prediction plugin if you have any questions about it !

rich ridge
#

@stoic nimbus sure. Is NP plugin stable enough

#

Is NP exhibit any unexpected behaviour

#

Is NP a good friend of GAS?

stoic nimbus
#

I've not used it with GAS, there nothing unexpected but there's a few thing not implemented yet, most of the documentation is in the "NetworkPredictionExtras" plugin, there's def some boilerplate to write before getting anything to work

#

the idea behind it is very solid once you understand how to split the "simulation" from the actual inputs

rich ridge
#

Yeah , even I had this feeling that migration from CMC to NP may require to write some boilerplate code

stoic nimbus
#

you need to isolate everything that can impact your simulation so that the engine can replay every step properly and interpolate if needed

rich ridge
#

So whatever you have explored in NP, what are the chances that the APIs will change

stoic nimbus
#

it got some heavy changes from 4.25 to 4.26, had to rewrite some stuff

rich ridge
#

Ohh I see

stoic nimbus
#

not sure how far we are from the stable solution

rich ridge
stoic nimbus
#

one very simple thing I didn't realize was that there is some project settings that comes with the plugin

rich ridge
#

Can you please share that setting?

stoic nimbus
#

just a few settings you can configure but I couldn't figure why some interpolation was not being call

rich ridge
#

Ok ok

#

Thanks brother for this wonderful information

stoic nimbus
#

If anyone can help me figure out why charactermovement's rootmotion is being glitchy or any other way to implement responsive movement abilities in multiplayer

peak notch
#

for android multiplayer is this right?CSharp [OnlineSubsystem] DefaultPlatformService=GooglePlay

clear sand
#

Hey guys, what would be correct way to store some information about player on server? For ex. in PostLogin() I would want to pull in some info from server and store it with player? Can I store it just inside PlayerController or there's more elegant way of doing that?

#

There will be info such as his inventory, etc

cosmic trail
#

Does anyone have a mirror of "building-and-hosting-an-unreal-engine-dedicated-server-with-aws-and-docker" article by Luke Brady? Not sure why the medium account was deleted

marble gazelle
clear sand
#

And also there is another part - personal data like tokens, etc, which only server and owning client should know

marble gazelle
#

the playercontroller is only replicated to its owning client

clear sand
#

ok, so its safe to put sensitive data inside playercontroller?

gritty pelican
#

if i will Replicate SkeletalMeshComponent, it will Replicate position with attachments?

foggy idol
#

firstly are you doing firstperson

#

if not then all you have to do is make the attachment an actor with the skeletal mesh as its root

#

then set the actor to replicate movement and attach it on the server

#

if your doing first person and use 2meshes for everything(i.e. not true first person) then you will need some extra replication code

gritty pelican
#

@foggy idol i need replicate USkeletalMeshComponent in My pawn

foggy idol
#

like its movement ?

#

or physics???

gritty pelican
#

no, i already make it

#

i not use sim physics

#

only Attachment

foggy idol
#

is the attachment a seperate actor ?

glad sedge
#

@cosmic trail docker for a dedicated server seems.. unnecessary

cosmic trail
#

@glad sedge does it not help with scaling on ec2?

#

I'm afraid of costs with dedicated servers running 24/7

glad sedge
#

Ah, TBH it depends on what sort of customisation you're doing on the server, so I guess it makes sense

#

But yeah, if it's about sclaing up and down, that makes sense. Docker for just one single instance is probs overkill IMO.

cosmic trail
#

yeah no, just thinking for the long term for a match making system with a bunch of dedicated servers running

glad sedge
#

yeah I've got a real deadshit simple setup at the moment

#

Haven't taken into account instancing or load balancing etc.

#

Many options these days .

cosmic trail
#

yeah that medium article on docker was great, I had bookmarked it but now it's gone. The github is still up tho

gritty pelican
#

where bReplicates in UObject?

//.cpp
UCPP_ItemBaseObject();
//.h
UCPP_ItemBaseObject::UCPP_ItemBaseObject()
{
    bReplicates = true;
// can't find this variable
}
cosmic trail
#

no where, UObject doesn't have replication abilities. First class that does is AActor

#

@gritty pelican

gritty pelican
#

ะ’ัะตะผ ะฟั€ะธะฒะตั‚! ะœะตะฝั ะทะพะฒัƒั‚ ะะปะตะบัะฐะฝะดั€, ั ัƒะถะต ะฑะพะปะตะต 5 ะปะตั‚ ั€ะฐะฑะพั‚ะฐัŽ ั Unreal Engine, ะธ ะฟะพั‡ั‚ะธ ะฒัะต ัั‚ะพ ะฒั€ะตะผั โ€” ั ัะตั‚ะตะฒั‹ะผะธ ะฟั€ะพะตะบั‚ะฐะผะธ. ะŸะพัะบะพะปัŒะบัƒ ัะตั‚ะตะฒั‹ะต ะฟั€ะพะตะบั‚ั‹ ะพั‚ะปะธั‡ะฐัŽั‚ัั...

#

but in russian language

cosmic trail
#

"By default, UObjects are not replicated over the network. "

#

from your site

#

he writes custom code to replicate it

#

He probably forgot to define bReplicates variable in his .h

gritty pelican
#

maybe

cosmic trail
#

no github?

#

yeah you're going to have to write your own stuff, whatever he's showing there is custom

gritty pelican
#

no git ๐Ÿ˜ฆ

#

okay, thanks

cosmic trail
#

Why you replicating UObjects tho?

#

you may want to consider replicating a manager if you have a lot of small objects

#

AActor is good enough and pretty lightweight enough for objects that you can sector off into different relevancy regions with the Replication Graph

gritty pelican
#

Objects will always be cheaper, so I want to try.

cosmic trail
#

I would make single storage actor that can replicate it's contents(it owns a lot of smaller objects) for an inventory system, all those objects are always relevant based on the actor

#

I think that would actually make it even faster, you can batch send any changes down instead of having each object do its own

meager spade
#

my inventory system does not replicate uobjects, but replicates a Fast Array struct, and the item uobject get created locally on client

#

found this a lot more managable

cosmic trail
#

yeah that sounds like the way to go. I was thinking of replicating uobjects way back when, it's really not needed

tranquil yoke
#

Hey guys, OnRep in C++ works like blueprints, which means, if one user has joined server and we have updated some variables for that user on server using OnRep,
when another user going to join later, then onRep vars for first will automatically update for new User.

fossil spoke
#

Yes

#

But OnRep do not get called automatically for the Server.

#

You must manually do the call in C++

tranquil yoke
#

if on Server i update onRepNotfied variable, its onRepFunction will not be called automatically for server ?

#

This happens in blueprints right

#

?

fossil spoke
#

Correct.

#

You must manually call OnRep_MyVariable(); after you change its state for Server.

#

Blueprint does this automatically

#

So you dont need to in Blueprint

#

C++ is different

tranquil yoke
#

Thanks.
First time doing RepNotify from C++.

#

What will happen,if i update the variable from blueprints, which is RepNotified.

#

Do i still have to call OnRep for server

storm rivet
#

Guys this widget is not being added to Player Window Vertical Box.

#

Please help!

#

P.S. I am following unreal's multiplayer using blueprint tutorial series on youtube.

hoary spear
#

Looks like ur trying to pass a server event to a widget

#

Afaik thats not possible

#

Usually i'd do things like that via the playercontroller

clear sand
#

Im trying to work on world streaming with dedicated server. I start my dedicated server with a map that has some sublevels, however when I connect as a client to this server - my client just floats in the air, since no levels are loaded. What am I doing wrong?

twilit stump
clear sand
#

Any advices where to look at?

twilit stump
#

Use stat levels to see the status of your sublevels

clear sand
#

From my client Im doing OpenLevel("IP on my server")

#

stat levels reports that sublevels are not loading on my client

twilit stump
#

Whatโ€™s the name of the top level loaded?

clear sand
#

Its the name of persistent level(parent of all sub levels)

#

but sub levels are not loaded at all(when in editor, loaded, they displayed as green in levels tree)

#

i might be missing something, but shouldnt I LoadStreamLevel() on my client manually?

twilit stump
#

Are you using world composition?

clear sand
#

yes

#

on the other hand, if I jump straight into parent level - it loads all sublevels automatically

twilit stump
#

Then no, that should be already handled internally

#

You can use open level on the server to initiate persistent travel for the server and connected clients

#

But on client I donโ€™t think that works

clear sand
#

Isnt OpenLevel("IP") on client connects client to dedicated server?

#

Thats how it currently works for me

twilit stump
#

Is your persistent map set as the default game map in project settings?

clear sand
#

no, default map for game set to menu level, and persistent map set as default for server

twilit stump
#

Is the server on local network?

clear sand
#

yep

#

ok it looks like some bug

#

I just changed map for server from persistent to some other and then back

#

now it finally loads corrrectly on my client

twilit stump
#

Hrmm yeah openlevel should work then, I canโ€™t really think of anything else without having a closer look

clear sand
#

so when I OpenLevel("IP") it opens persistent level on my client and loads according sub levels

twilit stump
#

So the level isnโ€™t loading on the server by default?

clear sand
#

it was, at least were logs about loading sub levels in terminal

hybrid zodiac
#

Hi all, I don't know if I'm being dumb, but I cant find anything online about how to override the game mode when starting up a dedicated server. I know you can pass in the map parameter like so:

MyServer.exe My_Map -log

#

But how do I also override the game mode?

twilit stump
#

Aight, so your client and server both have the persistent map loaded but the client fails to stream in any sublevels? @clear sand

#

When youโ€™re on the client, does stat levels list out the sublevels but show them greyed out, unloaded?

twilit stump
hybrid zodiac
#

@twilit stump I've done that, but maps can be played using different game modes. I want the dedicated server on boot to run a specific game mode

#

So the default game mode is team deathmatch, so when the dedicated server starts, it always runs TDM regardless of which map you pass in

#

I want to be able to do something like

#

MyServer.exe My_Map?Gamemode=CaptureTheFlag

#

So it overrides the default game mode and forces the specified one

twilit stump
#

AFAIK youโ€™ll have to make a duplicate level that loads with that game mode

hybrid zodiac
#

Huh, thats weird. So how do other games run a "CTF only" server? Just duplicate all the levels?

twilit stump
#

I worked on a game that had open world pve and pvp deathmatch, each game mode had its own persistent level

hybrid zodiac
#

That seems so redundant. That means I need 4 copies of every map, for each game mode

#

We have a way of changing the game mode in game through admin panel, I thought it would be possible to do the same thing on start up

marble gazelle
#

you could create a generic gamemode that loads a specific "GameRule" that provides the GameMode with specific information, if you can't override it at runtime.

twilit stump
#

GameMode defines how players login, finding player starts, spawning pawns for players to possess. I donโ€™t see how you can change that at runtime. Itโ€™s just something thatโ€™s serialized in the level/world

storm rivet
marble gazelle
#

well you can forward all this logic to smth you can load at runtime

twilit stump
#

Yeah, I mean you can branch the logic in game mode based on command arguments

marble gazelle
#

na, you shouldn't branch it

#

just assign a load a Handler with virtual functions, otherwise you will get lots of if/else

twilit stump
#

Yeah Iโ€™m tracking, theyโ€™re asking about overriding the game mode class at runtime though. Iโ€™m pretty sure thatโ€™s just serialized in the world settings for the level

marble gazelle
#

As said, I'm not sure if you can override it, but you can atleast load your handler dynamic on startup \o/

twilit stump
storm rivet
#

Just a sec, I closed my project...Opening again.

#

BTW what is the difference between get player controller and get owning player.

twilit stump
#

Sometimes

#

Ah yeah, is your event in a UMG widget?

#

The GetOwningPlayer says target is widget. If thatโ€™s the case you want to move this to your player controller

storm rivet
#

I thought the same and tried it basically used get player controller instead of get owning player(If this is what you are suggesting)....but I think issue persisted...

#

This too does not work

#

Update Player window Event is in a Widget BP.

marble gazelle
#

hmm doesn your server load UI and is your widget somehow replicated?

clear sand
limber gyro
#

hey peeps, i need to call "get all items" from a UE4 server

#

its steam stuff

#

any 1 with experience with this can give me a tip on whats the best way to do this?

storm rivet
#

Is steam best way to implement multiplayer server for indie?
Also, is it free?

limber gyro
#

theres also epic online services now, but the documentation is not as good

storm rivet
#

What is the advantage of dedicated server over peer to peer?

limber gyro
#

you should use google for that my friend

hybrid zodiac
#

@storm rivet Basically, better anti cheat and security. Having a trustworthy authority acting like a referee rather than trusting peers to be honest

#

Also, in P2P you are reliant on each peers connection speed, one weak link in the chain can slow everyone down. A dedicated server means one person on dial up won't slow everyone else down

storm rivet
#

Thanks a lot! @hybrid zodiac

hybrid zodiac
#

@storm rivet Youre welcome! there are more complexities to it of course, and there are reasons why P2P might be a better option for some situations

storm rivet
#

Sure I will google and do my research.
Meanwhile, maybe you can pin the answer!

#

@hybrid zodiac

twilit radish
#

Didn't UE4 only support a server and client model?

#

So either a listen server or a dedicated server?

hybrid zodiac
#

@twilit radish Yes, but I guess you can implement a P2P networking solution if you want

peak notch
#

for android multiplayer is this right?CSharp [OnlineSubsystem] DefaultPlatformService=GooglePlay

worldly ore
#

hello guys, I would like to use a websocket connection for each player. How could I initialize a connection and then call the same websocket in other blueprints to make emits ? Or how could I make a websocket blueprint where I would put all the emit functions inside, usable by all blueprints?

limber gyro
worldly ore
#

Because I want to use that like a Rest API, for user authentication / record player information in db / dispatch notification for everyone using ws, etc

candid ridge
#

has anyone here ever tried to replicate a spline component?

#

does not really seem to actually replicate anything. is it like a procedural mesh component, where you can check "Component repicates" but it doesn't really replicate anything because UDP potentially doesn't do well with replicating it?

chrome bay
#

None of it's properties are replicated

#

It's not designed to be replicated ultimately, but you can do it yourself either with a custom component class or just be replicating spline points separately

candid ridge
#

thanks, yeah i'll find a way ๐Ÿ™‚

#

already replicating procedural meshes via tcp ^^

#

(low poly ones ๐Ÿ˜‰ )

#

@chrome bay while we are at it, do you know why it's only possible to inherit from USplineComponent in c++ and not in blueprint?

velvet brook
#

Do you guys have any tips on how to make jumping not feel so floaty? More so like Mario or fortnite style

candid ridge
chrome bay
#

@candid ridge the class isn't marked as Blueprintable. Might be an oversight or might be intentional, not sure.

candid ridge
terse prawn
#

Overall is a "String" or "Text" better in terms of effeciency to send over the network?

vague fractal
#

Hey, I've got a question.
let's say i got the exact same project on 2 PC's.
How could i start the game (And the server, i guess ?) on my main PC while my second PC joins the server ?

#

Also as side note, both are in the same network

terse prawn
vague fractal
#

I'm really new to multiplayer development in general. I don't know the difference between both ๐Ÿ˜…

terse prawn
#

Listen servers are essentially just hosted from your game.
i.e open the game click host and then you load into a level/lobby or something

#

dedicated servers are more along the lines of opening another application which opens a console or whatever without having the actual game open

vague fractal
#

Alright, in that case it would be a listen server

#

At least if it can work like this

terse prawn
#

so you would have maybe a button on a widget or a keyboard button or something like that for the player to click to host the game
I'd strongly recommend checking out Unreal Engine's youtube channel as they have a tutorial playlist of how to get a basic lobby setup

vague fractal
#

Gonna watch those then, but as last question. Would this system work on non-shipped versions ?
Like that PC A and PC B both just have the editor open to join a server, or would i need a shipped version on both ?

terse prawn
#

Yes

#

It will work in PIE

vague fractal
#

Alrighty, thanks

terse prawn
#

Of course

#

just gonna bump my question
Overall is a "String" or "Text" better in terms of effeciency to send over the network?

marble gazelle
#

well sending text over network is always bad. Especially since you don't have localisation this way...
I'd rather send a Text GUID and load this on the client

#

but not sure how FText replicates, maybe it just sends the Localisation id, if present and otherwise the full string. If you generate the string at runtime it doesn't matter and you'll need to send a String

terse prawn
#

In the past I have replicated text without issue but It seems to noticeably slow down when the character length is longer.
I'm trying to replicate a description of a player's character in text from client to client Which can sometimes be up to 200ish characters

chrome bay
#

FText replicates as FString, which is generally considered expensive (more so as the length increases)

tranquil yoke
#

OnRep functions can be blueprintCallable right

#

?

chrome bay
#

Yeah

tranquil yoke
#

okay thanks

#

Is there Any guide, how to send data to server in an optimized way, i mean how to minimise your packets, specific data types to use for networking only? i remember there is something for FVector.

Do you replicate whole structure to server ?

chrome bay
#

You can't replicate stuff to the Server, you can only send data to the Server via an RPC

#

Replication is always Server->Client

tranquil yoke
#

yes, i mean are there optimized data types , which should be RPC to server.

chrome bay
#

There are a handful of basic types in the engine, but otherwise if you want to send reduced data it's pretty much up to your game to figure out how to do that

#

Different projects have different needs etc.

tranquil yoke
#

are there any good articles, how other developers has done for there games, so i get an idea.

if i have 5 Property which i need to RPC to server, should i put them in struct and then RPC the whole structure.

Which way will be the best

#

?

chrome bay
#

With an RPC it doesn't matter

#

Whatever is easier

tranquil yoke
#

we can make structs RepNotifies ?

chrome bay
#

how do you mean? repnotifies are done at the object level

#

But yes any replicated member property can trigger a rep notify

#

The network compendium is a good place to start (stickied in this channel)

#

As well as looking at Epic's sample projects

tranquil yoke
#

i have read that alot, i have okay understanding of multiplayer, when it comes to blueprints, i just want to do it right using c++, i always think my replication is not optimized.

RepNotifies are some kind of reliables ?

chrome bay
#

no

#

they are called automatically by the replication system client-side

#

Blueprint RepNotify aren't really proper rep notifies, they are just called whenever the variable changes - C++ ones are called when the value is replicated

tranquil yoke
#

okay, so only way to make sure, that if data is going to RPC are Reliables ? RepNotifies can missing too ?

kindred shadow
#

I am having the gamemode spawn my inventory items and of course its working fine for the listen server but for the client, I am not getting any items and I am not sure what I am doing wrong fully

kindred shadow
#

nvm I figured it out

smoky ore
#

Question: Is there something special I have to do in regards to replicating arrays? I can see an array exists on the server but not the client. The variable is marked for repliation and I do have the DOREPLIFETIME thing on it as well

#

The variable is in the GameState and is added during the GameModes PostInitializeComponents()

lost inlet
#

no but it may depend what it's an array of (actor references? structs?)

#

you can always ForceNetUpdate() after setting to make sure replication updates run next tick but it doesn't look like the default gamestate classes result in less frequent replication

distant monolith
#

Anyone have a straight up tutorial for how to make a dedicated server to test with others, that is taking best practices? Like ideally something I can set up to test what it would be like if we actually try to make it publicly playable

smoky ore
#

It's an array of a child of AInfo. I also made sure to that was set to replicate. Lemme try forcing a net update. I'm working with the same code i used in 4.25 but I don't recall this being an issue then.

#

thanks Swires

#

That didn't fix it, though I did find out what was causing it. It was just never in replication range. So setting it to always relevant fixed it for me

wheat magnet
#

should i need to replicate overlap event? i mean RPC etc

smoky ore
#

what would you be trying replicate? if I remember right, any overlap events occur on both the client and server

wheat magnet
#

when i try to attach actor to component in client side, my character is attached, but my character started stuttering and weird vibration movements, how to solve this issue?

winged badger
#

@smoky ore the client side array is empty or full of nullptrs?

smoky ore
winged badger
#

for a game state you needed to turn always relevant off for it to be off ๐Ÿ˜„

smoky ore
#

well the game state was fine

#

it was the actor i was trying to store that had the issue

wheat magnet
#

help would appreciated

#

but in server side, the character doesn't jitter

#

what cause the issue, this only happen when i do this :

#

this is rpc call

#

@winged badger can you help

meager spade
#

please don't randomly ping people for help @wheat magnet

wheat magnet
#

sure so can you please help why this occur

meager spade
#

someone will help when they can, i don't have time right now.

wheat magnet
#

ok great

steady fox
#

Hey, I've been reading that TMaps aren't supported for replication, and the general recommendation is TArrays for replication. I've been having a hard time finding info on which objects support replication in the docs. Do y'all know where it might be?

dark edge
leaden atlas
#

is there some way to add the ability to call server RPCs from actors other than ones owned by the PC

dark edge
#

Or just set owner if it's not something in the world that's meant to be shared.

leaden atlas
#

ive got a game with multiple pawns

#

kinda like an rts

#

i want to be able to call client->server rpcs from the pawns

#

i dont really want to stick everything in my player controller lol

dark edge
#

Do the client->server routing through the player controller or a flying pawn that represents the players camera

#

The PlayerController should have a pawn, what is it?

leaden atlas
#

the latter, a flying spectator pawn sorta thing

dark edge
#

Use that to do your routing if you don't want to do it through the controller

#

I'm guessing this is for selection and sending orders?

leaden atlas
#

yeah

dark edge
#

selection can be totally clientside, just have to RPC an order over with what the order is and who's the target etc

leaden atlas
#

kk. i mean that's what im doing

dark edge
#

Yah that's a good architecture. I'm sure you could probably work out some way to do RPCs in the units themselves but I can't think of any benefits and it'd make them all super overloaded

leaden atlas
#

๐Ÿ˜ฆ

#

alright

dark edge
#

I mean why do you want to do that anyway? What's the benefit?

leaden atlas
#

uhh kinda because like

#

you can also select items and buildings in stuff in my game, and they handle the input basically like

#

straight from the player controller

#

instead of the player controller doing any RPC stuff first and giving them commands

#

its so that right clicking is contextual. it can move a pawn if you have it selected or it can open a menu

#

etc

dark edge
#

It's easy enough to just make an RPC with parameters CommandEnum, Unit, Target, Location etc

#

open a menu doesn't need an rpc

leaden atlas
#

it doesnt

#

that's why i dont do the RPC on the player controller

#

i want to be able to handle it in the thing that's receiving the right click order

dark edge
#

so telling villager to chop a tree would be like Command = Attack, Unit = Villager3, Target = Tree32

leaden atlas
#

doing it as an enum really really sucks though

dark edge
#

or if the same keys do different things on different units, you can just do like CommandInt = 3

leaden atlas
#

maybe there's some way to do it with objects ๐Ÿค”

dark edge
#

.... why the hell would you do that lol

#

I take it you want same hotkeys to do different things on different units?

leaden atlas
#

why the hell would you enum out every single command in the game instead of using different objects?

#

yeah

dark edge
#

Just enum out the hotkeys then

#

or use an int if there's a ton of them

leaden atlas
#

but then i would need a big conditional or switch statement wouldn't i?

#

what i want to do here is avoid that with polymorphism

dark edge
#

You can have the enums map to events in the base class

#

then just implement those events, the same way you did direct input

leaden atlas
#

can you map enums to events?

dark edge
#

How many inputs in total do you have?

leaden atlas
#

i dont think blueprints have higher order functions right?

#

uhhh

#

just left click and right click right now

#

but there's about 20 different object types right now

dark edge
#

Wait, does anyone share units?

leaden atlas
#

that do different things when you left click and right click

#

nah

#

not yet

dark edge
#

2 players sharing units, is that a thing

#

why not just set all units owner to the player?

leaden atlas
#

how many pawns can a controller own?

#

also would that affect move to commands? do those need an AI controller?

dark edge
#

owning and possissing are different things

#

possessing implies owning

#

but owning doesn't imply possessing

leaden atlas
#

oh shit lemme try that out then

dark edge
#

Yeah i'm not sure how ownership works with an ai controller in the mix but try it

#

set owner needs to happen on the server but that can be done by the spawning building or whatever

#

I'd still prefer sending commands as that'd make building an AI that can play as if it was another player a lot more streamlined

#

and idk if there's any complications with enabling and disabling input on the fly that much

leaden atlas
#

shoot that doesnt work

#

after spawning it, it gets owned by the AI controller

#

even if you set the owner to the PC

#

okay ive got an idea

#

i can probably spawn some sorta actor with the pawn that handles client->server rpcs

#

yeah that'll work

meager spade
#

why not set the AIController owner to the PC?

#

that is all you need to do

#

although personally i would have a ActorComponent on the PlayerController that does pawn orders

leaden atlas
meager spade
#

ye

#

its how we do it our RTS

leaden atlas
#

huh

#

i cant get that to work

meager spade
#

why?

leaden atlas
#

i mean i can set the owner

#

but the client->server RPC isnt working

meager spade
#

your ai controller replicated?

#

we replicate ours to owner

leaden atlas
#

fuck yeah

#

that did it

#

thank you!

distant talon
#

Bit of a silly question but i noticed the onpossessed event for pawns only triggers on the server, there isn't an easy equivilent function to bind to for clients is there?

#

or do i have to do something silly like check for a valid controller on every frame until there is one

Solution: There is an onrep exclusively in CPP i didnt see before, i can override that to get the equivilent of a client side on-possess

dark edge
#

Turns out you can't replicate maps, does this look like an alright way to do inventory? There's 2 parallel arrays, AllowedItemSlots and EquippedItems. Different subclasses will have different AllowedItemSlots

worldly ore
#

Hello everyone, I already asked here for my issue yesterday, but I didn't find the solution yet - I will try to explain better what is my problem ...
Actually, I've bought Socket.IO Client from the marketplace, in order to use web socket communication on Unreal Engine to do all database requests in websocket (login/request informations on connection/dispatch informations for all players connected/...). I would implement that via blueprint because I think it is not needed to do that in C++. So, what I want :

  • When a player launch the game, the websocket connects into the backend. After connected, player will go on the "Login Widget" to connect into the game. I have tested to instantiate the websocket client connection on the PlayerState, and I've tested to get the SocketIOComponent from PlayerState to get the current websocket connection and do a request to the Node.JS Backend. But it does not work ..

I don't know if I have to do a separated blueprint to put all Socket functions (connect/emit/emit with callback/check if always connected/trigger reconnection/etc) and call the blueprint everywhere I need .. Thanks by advance for your help ..

clear sand
#

Are you familiar with cpp?

#

I have almost the same task and have good progress using cpp and grpc

worldly ore
#

I'm not really familiar with cpp and UE actually, I would have to look into the mechanics of CPP inside UE ..

#

Why use GRPC instead of websocket ? You choosed that for a specific usecase ?

bitter oriole
#

Can TSharedPtr-stored structures be replicated ?

meager spade
#

I think so. GAS does it I'm sure

bitter oriole
#

Interesting

#

Currently replicating structures, but I need them as TSharedPtr later to send to UI

#

(to get nice invalidation on removal)

meager spade
#

Check the abilityspechandle in gas

#

Yeah you can 100 percent use shared pointers

#

Might need to make your own netseriailizer

bitter oriole
#

Nice, thanks

#

I guessed I'd need that

worldly ore
#

Do you know what can be the best blueprint type to instantiate connection to websocket and put all events functions in there ?

twin juniper
#

hey guys, im just starting with ue and i wanted to know if there is some peer to peer host option built in for multiplayer games? such as (i imagine) among us where people can join a room that one of the clients host?

#

and if you have a link to tutorial video that would be great too

#

im planning to program a mobile game

terse prawn
twin juniper
#

haha @terse prawn just found it myself i just wasn't sure it would work on mobiles

#

since he mentioned steam there

#

thought its specificly for steam

terse prawn
#

I personally followed the videos and never used steam and still worked for me.
Its just steam makes it easier for clients to connect to the server because the steam online subsystem takes care of some more 'technical' details on connections (for a lack of a better term)

twin juniper
#

mm ok

#

then that would work, thnks alot man

terse prawn
#

Yee of course

tawny mason
#

Hey guys I was wondering if anyone knows some course in game oriented networking, I'm not talking about basics but an actual in depth course / knowledge source.

clear sand
# worldly ore Why use GRPC instead of websocket ? You choosed that for a specific usecase ?

So first of all - keeping connection opened for long time might lead to memory leaks if you forget to delete object and overall consumes much more resources than if it would be just request-response approach. Second - you need to take care about reconnects since websockets might fail at any point because of network lag or just high ping. Third - its getting really hard when you want to do loadbalancing. After all - you dont need constant bidirectional streaming for things like login or any other request based operations.

While websocket seems to be easy approach, it has some downsides in long running perspective. I've dealt with websockets in web development - and I dont really like them because of lots of issues with them when trying to do something more complex than just send few messages.

There is also a plugin VaRest which provides you http functionality to blueprints. Its worth to start with simple http request for your login/signup related stuff.

#

Once you get familiar with UE4 and networking, it should not be an issue for you to start to use any technology that fits your needs. Personally the reason I chose GRPC because of its simplicity and reliability. It also supports bi-directional streaming, so it can replace websockets. But besides it also provides unary calls(just like regular http request-response)

#

At first you need to understand what part of logic should be extracted to backend server, and which should be handled by dedicated/listen server. Having that in mind you'll have easier times to understand what fits your needs

timid moss
#

Is it possible to send a TArray<> through an RPC?

dense ocean
#

I have an event that is Run on Server and it fires very inconsistently. Why might it not fire every time?

limber gyro
#

if you have an unreliable rpc it will only run when the network allows it

#

but the mos likely scenario is that you are doing something wrong

weary badge
#

Hey everyone,
I'm still having trouble with the replication of a widget in my online multiplayer setup.
I tested the code in another project using the "post login" and all the replication worked fine.
The difference with my "real" project is that I'm using the "on player swap", but for some reason my replications don't work anymore unless I use a delay node ...
Is anyone here good at that sort of thing and willing to help ?

dense ocean
#

Thanks @limber gyro

#

Does anyone know why my AnimNotify only executes on the server sometimes? (unreliable)

#

Can i make these reliable?

limber gyro
#

you should be able to make anything reliable, you just have to pay attention to the network bottleneck i think

dense ocean
#

i'm in blueprint

#

animnotify only executes on the server sometimes but always on the client

#

im trying to get it to always execute on the server

meager spade
#

@dense ocean make sure the skeletal mesh is set properly

#

under optimization is the Visibility options, make sure either always play montages or its always visible and updates botnes

dense ocean
#

Thank you @meager spade this must be it.. what blueprint is this in? I can't find it in the mesh or animbp

meager spade
#

its on your skeletal mesh component

dense ocean
#

i set it to always tick and refresh bones, no luck

harsh lintel
#

is RInterpTo a good way to interpolate the rotation of the player character? If so how do I cancel the task if a condition is met?

kindred widget
#

RInterp or RInterpTo are just math functions. If you want conditions, either select between the RInterp or the current rotation, or simply don't do the rotation if the conditions is met before even using the RInterp.

harsh lintel
#

Alright thanks, another question, it is okay to use RInterpTo in a networked game right, it's not going to look weird, or is there a better function for this?

leaden atlas
#

i mean it depends on how you're doing the interp though

#

the interp itself isnt the issue

#

is there a way to spawn replicated actors only on some clients?

#

like how aplayercontroller is spawned on client, server, but not all clients?

meager spade
#

Override isnetrelevantfor

leaden atlas
#

fantastic, thanks man!

#

so wait im kinda confused

#

so if i override it then the replicated actor spawning wont happen?

crystal crag
#

I've been looking over the ShooterGame code... one thing throwing me off, is the UserId for dedicated server within HostGame:

bool HostSession(TSharedPtr<const FUniqueNetId> UserId, FName InSessionName, const FString& GameType, const FString& MapName, bool bIsLAN, bool bIsPresence, int32 MaxNumPlayers)

The dedicated server wouldn't have a valid player ID would it?

#

Also, I have been scanning the code base since this morning, and while most of it makes sense, I also don't see where in the code it is auto starting a session if you do start a dedicated server. It almost seems like it expects a player to fire up a dedicated server from the ShooterMainMenu slate class... even though in a dedicated server setup, there would be no player to check that option...

foggy idol
#

is it possible to serialize a UProperty

meager spade
#

UProperty is redudant in 4.25+

#

redundant*

#

and what you mean serialize?

#

for replication?

foggy idol
#

i want to convert a wildcard uproperty int bytes uint8

foggy idol
#

I also want to be able to convert it back

meager spade
foggy idol
#

I wasnt sure where to put it

#

i thought serialization was a multiplayer thing

meager spade
#

no and yes

#

your on about property serialization that is normal UE4 C++

foggy idol
#

how do i do it though ?

meager spade
#

#cpp we will continue

foggy idol
#

ok

limber gyro
#

any 1 has experience calling steam stuff from the server?

#

i need to call

#

but i dont know whats the best way to do it

#

is this REST call=

#

?

hearty wasp
#

I don't understand how to open the inventory clientside, like how to get the owning player

#

on a multiplayer server

meager spade
#

make that event a Client RPC

#

"Run on owning client"

#

no need for the OwningPlayer to be passed in

#

that event will need to be on the PlayerController or Character

hearty wasp
#

It's in player character?

#

@meager spade It does not appear to work still.

slender mortar
#

Make a print string there to make sure that it is actually called, and to know by which machine (server, client?)

tranquil yoke
#

@meager spade Hey, Do you write your own Actor and Component Movement Replication System ?

hearty wasp
#

Big Thanks to everyone in live discord voice chat for helping me resolve my issue

fossil spruce
#

Hey everyone, need help
I'm trying to make a co-op game between VR and desktop. Problem is, I can't get this spawner thing working with multiplayer. I created a pawn that spawns by default, and depending either you are a desktop user, or VR, it spawns specific character and possesses it. When hosting it spawns and possesses normally, but when joining: it spawns a TPS character no matter VR or not, and no input is working Any tips?

winged badger
#

use an optional string when joining a session

#

to indicate if you're doing desktop or VR

#

that particular logic is bound to end in a disaster though, even if its in GameMode

crystal crag
#

Zlo, do you work for wildcard?

#

*wildcard studios

#

I ask because of your avatar picture

winged badger
#

no, ironward

crystal crag
#

oh so you work with Kaos then. That's pretty cool.

fossil spruce
winged badger
#

and it runs on both server and client?

#

you can imagine how that could be problematic

#

also server has no clue if client had VR pluigged in or not, unless client tells it that

fossil spruce
#

I'm not entirely sure, I haven't dealt much with spawn manager in MP before

winged badger
#

client should not spawn replicated actors

#

and with thst you shown above, it does

fossil spruce
#

@winged badger Man it worked! Thanks a lot

#

Now I have to figure how to get rid of the server spawned character?๐Ÿ˜…

harsh lintel
#
        TargetRotation, DeltaTime, TurnRateInSeconds);

    Ability->GetAvatarActorFromActorInfo()->SetActorRotation(NewAvatarRotation);

Is this the right way of using RInterpTo in a networked game? Im getting weird behavior

lost inlet
#

you probably want to send the location its attempting to look at and updating it client side because otherwise you're relying on the server to do the updates which won't interpolate position updates at all

harsh lintel
#

is there a better way to interpolate rotation than RInterpTo?

#

network friendly?

#

maybe AddControllerYawInput? I just have to figure out how to transform ``` FRotator NewAvatarRotation = FMath::RInterpTo(Ability->GetAvatarActorFromActorInfo()->GetActorRotation(),
TargetRotation, DeltaTime, TurnRateInSeconds);

lost inlet
#

you will have to process it on the client to guarantee smoothness like I said

#

though if this is a locally controlled pawn, then that might be a bit different

#

since it might be the pawn trying to follow the controller's rotation

harsh lintel
covert garnet
#

hi, I am implement a rewind system to do HitScan in server, in the system server keeps the pose and root of all player character, when a player fires a gun, server rewind other characters to do HitScan, included root location and animation pose. Now the root rewinding is ok, but pose rewinding is not ok, because server doesnot sync animation pose to others, we only sync the move speed, then animation bp select the animation by the speed, anyone has good idea to fix the problem? thanks

bitter oriole
#

If you truly want to rewind the entire scene and check the hit per bone, then you need to have all animation run on the server in a way that is deterministic and the same as the firing client

#

Most games decide this is an impossible task and go with simple bounding box checks

#

Like, usually on a client the animation state of the player you're shooting at is derived from interpolated transforms between replicated transforms from the server, the server has access to nothing of that

#

You basically end up needing the client to tell the server the entire anim state and then what's the point of checking it since you're trusting the client ?

thin stratus
#

Given Valorant, being basically a UE4 Counter Strike, really needs hit registration to be "correct" and "clear", this might be helpful

bitter oriole
#

And they do use anim state in the rewind

#

But Valorant has done very extensive effort to get a great shooting feel and I don't think it was easy ๐Ÿ˜›

#

And they go on with an example of animation state mismatching on server and client, where they decided to trust the only animation state that made sense - the server's - causing the client to miss correct shots

covert garnet
#

yes, server is god

chrome bay
#

You can do pretty simple verification without having to rewind the animation. Just depends how intense you really want to go, and how complex your damage model is

#

If your damage model is pretty simple, checking the hit as distance-from-rewound-capsule is more than secure enough

blazing cloak
#

Hello. I'm trying to setup sessions with Advanced Sessions Plugin. Everithing is looking good, except that I want to be able to cancel session serch. For that I'm using "Cancel Find Session" node, and it gives me print on success, witch is great. BUT, later when I call "Find advanced sessions" On success pin gets called several times, even though "Find advanced sessions" was called only once.

chrome bay
#

You should block "finding" sessions until the cancel is completed successfully

#

Likely messes up if you have a pending find and cancel at the same time on some OSS'

blazing cloak
#

how to block finding sessions?

chrome bay
#

Simplest approach, use bools to prevent it

bitter oriole
#

if (session in progress) then don't

#

Build yourself a state machine

blazing cloak
#

but finding sessions is already in progress when I do cancel.

brazen sluice
#

Hello, quick connection, I have a SET (FNAME -> Bool) that is my state machine for animation (like attacking or hit is true to play the anim in the anim blueprint)

#

My idea was to replicate it

#

Except sets cant be replicated apparently..

#

Do you guys have a better alternative solution to store my anim states?

bitter oriole
#

TArray of pairs of FName -> bool

brazen sluice
brazen sluice
#

I guess array is closest solution

#

Thanks

bitter oriole
#

Yeah

meager spade
#

Array is the only container that can replicate

#

so you have not much choice

dark edge
brazen sluice
#

Yea

#

{
Attack : true,
Hit: true
Dead: false
...
}

#

Then I blend animations based on that @dark edge

dark edge
#

The whole point of a state machine is that states are exclusive so an email is a lot better fit than multiple booleans. What if somehow you have a bug in both alive and dead are true? If alive and dead are just States in your status in them then they are mutually exclusive

brazen sluice
#

Oh I did not know those things existed

#

Where can I find them how are they called?

#

Thanks @dark edge

dark edge
#

Enumerations or enums.

brazen sluice
#

Ahhh you mean creating ONE variable as a state

#

Yeah tbh it might be enough

#

Im just kinda worried with ENUMS that it's just not as flexible

#

But it works for sure

dark edge
#

I mean one per dimension or slot of State. so one variable representing what the upper body is doing, be attacking running grabbing shooting whatever. And enum can be thought of just like a Boolean but with more than two states.

azure hollow
#

Hey guys I'm implementing a multiplayer system. All I need to do is a racing with ghosts of players. What should the best way to set this up? Do I need Dedicated servers?

dark edge
azure hollow
#

It's not 'live'. You basically race with the best records on the leaderboard (closest to you)

#

Like Trials do...I don't know if you know that game!

meager spade
#

seems like a local game, but pulling data from a server, setting up the ghosts, and just racing

dark edge
#

If that's the case, it's basically just a leaderboard with extra data. Should be fairly easy

#

Do you know if you can do arbitrary save game sharing across steam or do you need to explicitly share something? I suppose that any game that has user profiles that you can just look at would be saving data that could very well be a recording of a run.

#

Although if that's the case, could a virus theoretically spread through Steam, hitching a ride on save games and some sort of insecure app?

azure hollow
sinful tree
azure hollow
#

Yes of course I was thinking about Amazon, no problem for money...I just wanted to be sure what's the best way

sinful tree
#

When dealing with an array set to onrep notify,, are only the array elements that are changed replicated? ie. it doesn't send the entire array over when only one specific element in the array changed?

azure hollow
#

I'm sorry i don't understand your question...But at this point I don't know exactly how to do this. My idea was to record Transform of the pawn, save the array and play next time...is it correct?

meager spade
#

you don't want to record every frame

#

but a position every X frame

#

and interpolate between each point

#

(will reduce database size)

royal light
#

Would a good way to communicate cursor position to the server be calling two separate functions on inputAction, one for setting a replicated FVector and the other for telling the server to try and go to it?

silent valley
#

Client must call RPC to tell server its cursor position, then if you want other players to know it you should get the server to set a replicated var. Be sure not to call the RPC every frame or you'll swamp the network like I did ๐Ÿ˜„

#

Remember, only server should set replicated var. The only way a client can talk to the server is via RPC.

royal light
#

Copy that! Thanks!

#

Wait is there really no other way for a client to tell a server 'try and go here' ?

meager spade
#

only via a server rpc

royal light
#

๐Ÿ‘

royal light
#

Well that got it to work

#

So basically i get the mouse hit on server, sent it as an argument via RPC to the server. But that means there has to be some manual validation ?

#

I feel like not checking it would open me up to some bugs/exploitation

steel vault
royal light
#

Oh i hadnt thought about sending the mouse via rather than sending the impactpoint directly

#

I think thats probably a safer option then, ty!

cosmic trail
#

Are reliable multicasts always sent even to non-relevant actors?

chrome bay
#

no, only relevant ones

#

they used to do that but it was changed some time ago IIRC

cosmic trail
#

ok yeah, forum posts are confusing me, not sure what's the current state. Thanks!

chrome bay
#

Oh you know what, one sec

cosmic trail
#

Is there a doc somewhere outlining the opt-in push model for replication that I heard about? Can't find anything related to it.

chrome bay
#

Okay sorry, turns out I was wrong - reliable multicasts still ignore relevancy apparently

#

But you can disable it globally with net.AllowReliableMulticastToNonRelevantChannels (which defaults to enabled)

cosmic trail
#

ok, yeah that's a big thing to know

#

ic

chrome bay
#

Had to go hunting through UDN, wanted to be sure ๐Ÿ˜„

#

UNetDriver::ProcessRemoteFunction is the offending location

#

So if the actors' channel is active, it will send the RPC

cosmic trail
#

if it knows about it, cool thanks!

worn lodge
#

Hey guys, quick question: I have a OnPostLogin function in charge of Spawning the initial character and possessing, I've already got it to spawn and used the reference to call the Possess function from the Controller passed by the OnPostLogin but I don't think its really allowing possession, I've also included SetOwner(Controller) but still nothing. Anything I might be missing here? I've confirmed with SetOwner, that it is in fact the PlayerController, but printing NetOwner is not the same, and so I assume thats why its not allowing to move the pawn.

gritty pelican
#

How many bytes does FName spend during replication?

winged badger
#

as much as a string of equivalent length @gritty pelican

#

if you want cheap, use FGameplayTag, which is a fancy name, but one that has to be defined at compile time, so it can replicate as integer

#

@worn lodge that is not PostLogin's purpose

gritty pelican
#

i think make int32 will be better

winged badger
#

use AGameMode::HandleStartingNewPlayer, which is called immediately after (PostLogin->GenericPlayerInitialization->HandleStartingNewPlayer)

#

your problem is probably that HandleStartinNewPlayer's default functionality is to spawn a DefaultPawn for the Controller and possess it, and it runs after

#

if you're overriding it from BP, if you don't add a call to Parent function, there will be no default spawning done

#

bonus: HandleStartingNewPlayer actually works with SeamlessTravel as well, not just hard travel

harsh lintel
#

Anyone has an example of a networked RInterpTo to rotate a character? I searched "RInterpTo" in this channel but answers are not really clear for me

winged badger
#

replicate desired rotation

#

have every machine do its own interp towards it

harsh lintel
#

I'm doing it on the client but I guess the server isn't allowing me to rotate it because it's not working

meager spade
#

doing it just on the server won't work

#

at minimum server and client.

harsh lintel
#

seems like the rotation on the client is wrong, but the server rotation seems fine

#
{
    // In order to realize any kind of ability we must first realize the TurnRate task successfully
    TurnRateTask = UDTPAT_TurnRate::TurnRateTask(this, FName("TurnRateTask"),
        FGameplayTagContainer(), DataHandle);

    TurnRateTask->OnCompleted.AddDynamic(this, &UDTPGA_InvokerTornado::CreateTornadoActor);
    TurnRateTask->EventReceived.AddDynamic(this, &UDTPGA_InvokerTornado::EventReceived);
    TurnRateTask->OnCancelled.AddDynamic(this, &UDTPGA_InvokerTornado::OnCancelled);

    TurnRateTask->ReadyForActivation();
}
rigid zinc
#

I'm trying to make a listen server game, and currently I need to manually port forward on the host then enter the IP of the host on the client to establish a connection. I'd like to bypass the IP part by having a simple server that handles matchmaking (while keeping the game running on the listen-server). However, I would still need to do the manual port forwarding on the router of the host. From what I've read online, common ways to go around that is to either do NAT Punchthrough, which UE4 does not support natively (would need something like UPnP), or use the Steam OnlineSubsystem. Are there any alternatives? And for the Steam way, do I need to publish the game on Steam and have every player create a Steam account in order for the OnlineSubsystem to work?

winged badger
#

your listen server's router doesn't expect to be contacted from clients IP

#

so it ignores the message

#

if your host were to connect to public server, give its IP so the public server would know to send it packets, and then your clients also connect to that public server and communicate a desire to join the listen server, then the public server would send the listen server a packet instructing it to send a packet of its own to client's IP:Port and after that client could connect, as it would no longer be ignored

#

as for steam, the ID is 100 bucks, and yes, they would need steam accounts

twin juniper
#

This do NAT Punchthrough, which UE4 does not support natively (would need something like UPnP) is confusing to me, I don't think UE4 on layer 7 would ever need to know what's happening on layer 3, meaning if routing and forwarding is set up properly between any devices you see fit in your public topology, everything should work just fine, because why would Unreal care about NAT? I am mainly talking to myself... ๐Ÿ˜„

rigid zinc
winged badger
#

it would

rigid zinc
#

Or it would, but that's ok because now the server has opened it and that's what matters

winged badger
#

but then it would be expecting a reply

#

so it would not ignore next client's packet

rigid zinc
#

I would still need to do the port forwarding on the listen-server's router though, right?

rigid zinc
vivid seal
#

Hey guys, my ability component that I'm working on is something that I want to work for both players and NPCs. As such, I need it to work server-authoritatively, and also support client prediction. I decided to do this with inheritance, with a basic "AbilityHandler" that works server-authoritatively, and a child of that "PlayerAbilityHandler" that overrides TONS of functions to support client prediction and rollback. I'm just wondering if this is the wrong way to think about things, as what I'm finding is that I still want to use all of the server side functionality from the parent class, so almost everything I override is checking GetOwnerRole() != Role_AutonomousProxy and if that returns true I am just calling Super::Function() and returning, and if it returns false I'm doing the "predicted" version of the function. It feels very messy but I'm not sure if that's just due my experience level or if there's a simpler/clearer way to do this.