#multiplayer

1 messages Β· Page 595 of 1

twin juniper
#

do people use gamestate for spawning?

kindred widget
#

You'd spawn them on the server as a replicated actor, or if you don't want them replicated, make a replicated property in the Pawn or somewhere that could spawn them client side only.

#

What are you trying to do though? What is the item you're spawning and attaching to the player?

twin juniper
#

i have an spatial inventory i can drag and drop iitems on the ground

#

but i want other players to beable to pick them up

#

just was thinking of best spot to do all this

#

when i drop an item from inventory it uses gamestate

#

function*

#

I guess i can keep using game state

kindred widget
#

What do you mean when you say spatial inventory?

twin juniper
#

diablo 2

#

grid

#

it uses a component for the inventory but trying to keep the component clean and bare so i can reuse it

kindred widget
#

Initially I'd probably say Gamestate is useless here. Pretty much all of that can be done from the component. What is the component a part of?

twin juniper
#

a part of? like my player uses it but i want npc to use it too

#

for like trading

#

i can show you the tutorial i followed

kindred widget
#

So it's on the Pawn?

kindred widget
#

You should be able to do that fairly easy then. Just create a drop function that gets the owner's location and do whatever little drop animation you want and allow players to call it. You'll avoid using a different class for it too.

twin juniper
#

yah i got all the functionality just need to add the remove item from my equipment slots

#

just was thinking of best spot for logic but i guess rpc in my pawn should be fine

#

i have a base class for the pawn so that would be used for npcs

kindred widget
#

If you network the component, you can use it itself to server RPC to the server version of itself from the client, and have the server version spawn the dropped item.

twin juniper
#

well i don't need it to able to really drop items thats almost additional functionality

#

because i plan on npcs using the component

#

so you can buy items from them and stuff

#

network the component?

#

like how do you do that?

#

oo you mean to make rpcs in the component?

#

probably will end up doing that for trading

#

kinda have too

kindred widget
#

Yeah. It avoids using the Pawn itself, so you can keep encapsulation without casting to the Pawn. That way there's no direct references to the player or the NPC

twin juniper
#

hmm thanks i'll try to do that

royal sigil
#

Hello everyone!
In Camera actor there is a auto activate for player option. Is there a default way to do this for all multiplayer controllers?

unkempt tiger
#

Does SomeReplicatedProperty_OnRep() get called after all replicated properties were called by any chance (can I assume that other replicated properties are up to date inside an OnRep()?)

#

Or should I use a post replication function type thing with some flags set up?

bitter oriole
#

Replicated properties are not atomic

#

PropertyA and PropertyB may not replicate in the same packet even if they were changed together

unkempt tiger
#

Oh, not sure why my impression was that they were

#

Does putting them in a ustruct as uproperties ensure that they are?

bitter oriole
#

No

unkempt tiger
#

Oof

bitter oriole
#

AFAIK, marking the struct atomic, does ensure that though

unkempt tiger
#

Is it just a matter of adding Atomic in the ustruct specifiers? neat

#

The real question is why did I have no idea that the atomic notion exist up until now sadthink

lime leaf
#

Hmmz I am having a weird issue with replicating a random seed, then setting seed and resetting a non-replicated randomstream on both client and server, same seed, still getting mostly identical results, but not entirely :/

#

it might not be the randomseed's fault, might be that some instances of a ISM aren't instanced.. hmm

#

At least theoretically when I spawn a replicated actor on the server with a transform, the replicated actor should have an identical transform, if always spawn/ignore collisions, no physics or collision interfering I think

#

Just weird that it looks almost identical but some pieces (crystals and gold) are bigger, scaling also follows the same randomstream, positions seem right, some pieces seem missing, but most are correct

bitter oriole
#

Are you sure that the order of calls to random stream is consistent on all clients ?

lime leaf
#

Hmm, it is blueprints with nodes, if of some reason the order of nodes varies IDK but hope not

#

On the same machine, two windows two players in PIE

#

"one process"

bitter oriole
#

Define "order of nodes"

lime leaf
#

But yeah you could be on to something there.. order of nodes, just the linking between them, it is a chain of nodes after eachother

#

the "run in one process" not sure what it does with blueprints, neither if always nodes are executed in the same order (if not needed to be)

#

I could do a sequence instead of a long chain, just thinking loud

#

if of some reason the chain is executed not equal hence the result varies, but the "sum" of the chain nodes, the number of nodes, keeps the result appearing almost correct

#

weird..

bitter oriole
#

The order of Blueprints is not guaranteed

#

The order of nodes whithin a Blueprint is

lime leaf
#

Yeah, I just put the nodes in a sequence, I discovered what seems to be wrong, it chooses a random ISM to make an instance in, to vary pieces of crystal, it uses a random integer in range from stream, but it uses the ISMs_Crystals length as a max, which should be identical but I'll have to look at it..

#

they should be identical, just two different pieces, array set in constructor.. hmm, but the difference on client server is that it is not the same piece

#

random integer in range 0-1 .. when it is the same piece on server and client, the size is the same, position, rotation, everything, but for some odd pieces it appears to fail

#

I think I've found it.. OreNrPieces is set from another randomstream on the server, which I also need to sync up.. OreNrPieces shouldn't have been replicated, it was

unkempt tiger
#

Quick question in regards to implementation design.. I want it so when simulated proxies get hit with a bullet, that when they die, their corpse will take some impulse vector to apply physical force on the ragdoll
Before I was using an RPC of the form MulticastReceivePackedBulletsDamageAndDie(BunchOfBullets, ImpulseVector), but then I realized that my IsAlive boolean (which I set to off in that function) should instead be a replicated property. Naturally on OnRep_IsAlive, I should ragdolize the character if it was alive and is now not. But in this case, I have no good way of applying any impulse vector. Right now my solution, is on the server, when a player dies from a bullet, call MulticastReceivePackedBulletsDamageAndDie(BunchOfBullets, ImpulseVector), AND set IsAlive to false, but that feels like double the work and not ideal as well

Is there any good way to go about this?

lime leaf
#

Problem fixed, now they're identical πŸ™‚

kindred widget
#

@unkempt tiger How does your damage work? Like clients shooting other characters. Is this all done server side, or do you use Client side input when they shoot something, and fake their shots on all other clients?

unkempt tiger
#

It's kind of an involved system, basically inputs are synchronized and played on every instance, predicting client, server and simulated proxies. Inputs generate bullets - meaning the bullets are simulated on all instances too. When a locally controlled player shoots a bullet and hits another player, it sends a request of consideration to the server with the hit results, the server validates them by finding the corresponding bullet, tweaks them to its liking etc, and then multicasts the server-authed results

chrome bay
#

@unkempt tiger in HLL we replicate the damage event with the health state

#

As part of the same struct, that way they can never arrive independently

unkempt tiger
#

And is that struct with an atomic specifier? @chrome bay

chrome bay
#

It's just a USTRUCT with the following uproperties:

UPROPERTY(Transient) FDamageEvent GeneralDamageEvent;
UPROPERTY(Transient) FPointDamageEvent PointDamageEvent;
UPROPERTY(Transient) FRadialDamageEvent RadialDamageEvent;```
#

And a few others, but ultimately that's all there is

unkempt tiger
#

What does transient mean? Also I understood that it's not guaranteed that uproperties of a replicated struct will all replicate at once unless the struct is marked as atomic?

chrome bay
#

AFAIK all struct properties should be received at once, at least they seem to be in this case

#

Assuming you modify them all in the same network frame anyway

#

I'm not sure if Atomic is required, I don't have it specified

unkempt tiger
#

Huh, alright, I guess it's worth testing then

chrome bay
#

I've never had any issues with it that way anyway

#

When we had them as separate properties, it caused trouble all the time

unkempt tiger
#

So I suppose that the engine kind of guarantees that your new property values' are replicated properly simply because of the health change?

#

What if something lowers the health, but there was no damage event somehow, if that exists? How do clients know that the player was in fact not damaged?

kindred widget
#

It's likely just something where the actual replicated property itself is checked if it's different. If it is, it'll replicate all of the changed parts. So if it's a struct, every change in it would get replicated together.

grim lintel
#

Hi all. Has any of you guys any info about how I can go about the creation of a join/drop menu for local multiplayer? Or specifically how I can detect gamepad input by index? Do I have to create player controllers first?
Any help would be much appreciated. Thanks in advance, have a good rest of your day, evening or night. My googling session wasn't that fruitful. "GetUserIndex" from KeyEvent always returns 0.

winged badger
#

iirc you create players

#

not just player controllers

#

game instance should have functions for that

chrome bay
#

@unkempt tiger there's a byte in the struct that we increment too to ensure replication

#

And some flags for what is relevant at the tike

unkempt tiger
#

Ah, very good

#

This was the part I was missing

winged badger
#

@unkempt tiger for custom net serialize, with flags for whats relevant, FHitResults NetSerialize function in the engine is an excellent example

glad sedge
#

Anyone have an idea on why 'SetControlRotation' on Controller is smoother vs setting rotation via Pawn?

#

Using CMC with multi.

#

on rotation w/ setting on pawn it's just a very subtle jitter; like it's updating every ms on the turn.

chrome bay
#

Using the built-in behaviour works with the network prediction

#

Arbitrarily setting it's rotation won't be part of that

glad sedge
#

ah right.

#

ah gee, I gotta dig into that a bit more I think.

chrome bay
#

UCharacterMovementComponent::PhysicsRotation

glad sedge
#

What's the go there?

#

Does that handle rotation w/ multi better?

chrome bay
#

That's where the rotation is calculated at least

shadow schooner
#

hello quick q

#

where should I store variables that I dont want to get reset when I servertravel to another level?

#

Cuz I have some replicated variables on each player with different values and when I servertravel boom they all get to the dfault value

bitter oriole
#

PlayerState, using some of the functions inside that check what's kept

empty axle
#

@shadow schooner ```cpp
/** called by seamless travel when initializing a player on the other side - copy properties to the new PlayerState that should persist /
virtual void SeamlessTravelTo(class APlayerState
NewPlayerState);

#

there is also

virtual void CopyProperties(APlayerState* PlayerState);
thorn cairn
#

hey guys quick question. I might have understood something wrong here:

https://docs.unrealengine.com/en-US/Support/Builds/ReleaseNotes/4_25/index.html

New: Full address protocol resolution and round robin connection attempts are now made in the IpNetDriver/IpConnection classes automatically. This enables connecting over both IPv6 and IPv4 networks, and takes advantage of platforms that can use both in order to find the best method to connect to a server.

Platforms where this behavior is not desired must call DisableAddressResolution either in their connection class constructor or in InitLocalConnection and InitRemoteConnection before calling any base class functionality. This will make sure that resolution is properly disabled for inherited IpConnection classes.

For testing, users can take advantage of CVARs such as net.DebugAppendResolverAddress which will always add the value to any address resolution done and net.IpConnectionDisableResolution which will disable address resolution on any future connections made.

and

New: IPv6 support is now included by default in all desktop platform builds, but is disabled. Setting the CVAR net.DisableIPv6 to 0 will enable IPv6, provided there is device OS level support.

Network addresses should be passed through a resolution method like GetAddressInfo in order to express the address in the best way possible.

SetIp and GetAddressFromString are still usable, but may require address translation in usages where connection protocols are not defined anywhere.

does that mean we can use ipv6 to enable sessions now?

Thanks for your answer πŸ™‚

rich ridge
#

As per my understanding This is something which is implemented at OSS level.

#

So for multiplayer and replication use cases you should not worry about ipv4 or ipv6

thorn cairn
#

when I connect players via my matchmaking server I need to provide the IP tho. Using v4 and v6 here is a big difference. As far as I knew it wasnt possible to use ipv6 so far

#

but I could be wrong here

#

thatΒ΄s the reason for my question

rich ridge
#

If you see the OSS like epic or steam they do have custom network driver class.

#

And yes for matchmaking and session fall into OSS layer.

thorn cairn
#

I know but due to some limitations I cannot use third party OSS

rich ridge
#

It's very difficult to maintain OSS by yourself. Whatever OSS you are using you have ask for ipv6 support from them

rich ridge
thorn cairn
#

yes

#

I am using my own backend

#

but NAT punch through / relay is a big problem here tbh

#

the rest is fine

#

I thought using ipv6 might help to solve this problem

#

or at least help

rich ridge
#

I m not god level expert in networking..
Do your machine have ipv6 address?

thorn cairn
#

which does not

rich ridge
#

Usually home brodband has dynamic ipv4

#

So how are you testing?

thorn cairn
#

so you do not have ipv6?

rich ridge
#

My ISP gave me ipv4 address.

thorn cairn
#

ok

#

I would need to test theses things. But unreal supporting it is a basic requirement for it

#

sooo.. does it? πŸ˜„

rich ridge
#

If the machine doesn't have ipv6 address so how come hosting session will have ipv6 address??

thorn cairn
#

I have not one machine without ipv6 adresse

rich ridge
#

Just a quick hack... The mobile network do support ipv6, you can use it via USB tethering...@thorn cairn

#

You need to enable ipv6 in Android in networking settings first

thorn cairn
#

I am only shipping for desktop right now

modern swift
#

hi all anyone know how to ignore error for dedicated server. it is easy to close the server if there are some error

rich ridge
thorn cairn
#

aahh

#

ok

#

I will test it later

rich ridge
thorn cairn
#

after some more research due to your points

modern swift
rich ridge
#

I guess you are using windows dedicated server?

#

If yes then on fatal expection the window will close and you can't see the exact crash log..

modern swift
#

yes

#

this is the log

rich ridge
#

As per the log it is NPE crash.

#

After move finish of your AI

modern swift
#

there is no breakdown to see what variable have NPE error

#

only can guess?

rich ridge
#

I think you can attack debugger to your dedicated server..

#

Your dedicated server is also a process.. and you can attach debugger to a process in vs

modern swift
#

ic let me try thx

kindred widget
#

In C++, OnRep doesn't run automatically. You have to call it yourself unlike Blueprint OnRep

#

Doesn't run automatically on the server*

#

Just on the server, at all. It will only run Client OnReps if you just set a variable. So for example, that code would never call the OnRep on the server, ever.

#

Yep. I see a lot of people wrap a lot of their replicated values in a function for that. Sets it and calls the OnRep afterwards in the same call.

limber gyro
#

do level blueprints only exist localy?

#

i am trying to understand how they work in replication

#

i was under the impression that they had a server counter part

#

but i have to call a server function inside the level BP in order for it to affect replicated players

#

for example, for a pawn if i do something on tick it will do that same thing both on the server and on the client because they both have the same function but the same doesnt seem to apply to level blueprints

rich ridge
#

As per my understanding levels are not replicated. And thus level blueprints can't replicate too.

#

Levels are like solid state and will not change no matter what, so need to replicate. Server only interested to updates the pawn's transform as per his copy of level and the same transform is replicated to clients and it works perfectly fine because the client's level is also same as that of server

#

If you are to connected to a server then both the client and server needs to have same map

#

To be specific same version of map

#

Else connection will be refused

#

By server

limber gyro
#

why cant you just put that string in the game state and replicate it?

#

cant you simplify the string some how?

rich ridge
#

If you think string replication is bad..then how are you replicating string when clients are connected???

limber gyro
#

maybe you could fetch like a json

#

on connect

kindred widget
#

What are the strings for exactly? What do they have access to that both the client and the server wouldn't through some other datatype means?

limber gyro
#

maybe you can have a float with the string version, and then when that float changes you can fetch the thing

#

i dunno man, why dont you explain the system in more detail

rich ridge
#

Why don't you create map of these and send ids across?

limber gyro
#

maybe we can brain storm something

#

steam makes you download the file itself in the case of user profile images

#

man thats a task and a half

#

there arent many games doing that

#

if any at all

kindred widget
#

Either way. Replicating a string once isn't terrible if it's necessary. The only real difference I know of the RPC vs Replication is the very tiny amount of CPU overhead of checking the replication. Replication is of course easier to manage in that regard without all of the RPC back and forth.

#

Not something I'd do every second or so to every client, but every so often isn't going to break anything.

limber gyro
#

sincei ts virtual production you dont have to woorry that much about performance i think you can handle a string

#

do it like i said, make a version check with a float

#

and then when it changes get the string

rich ridge
#

The best posible way is your client upload the file to S3 or similar storage and once upload is done you broadcast the link to other clients.

limber gyro
#

dude your asking like ID software level stuff, speaking for my self its hard to have a grasp on that, maybe your on a level where you have to make your own new systems

rich ridge
#

This was you aren't choking the replication driver

limber gyro
#

so they edit the mesh itself?

rich ridge
#

Host will need to have a copy locally

#

For every edit upload the file or diff

limber gyro
#

so you want to replicate 1000's of actors each with their names and colors and stuff and they all have to replicate properly

#

just to make sure i understand correctly

#

so if they are important only before spawn you only need to replicate them once no?

rich ridge
#

As your mentioned your players can import fbx means you have to somehow replication mesh and skel mesh too ..m

limber gyro
#

its very hard to come up with solutions when you dont have a proper grasp of the concept

rich ridge
#

And Engine doesn't replicate mesh and skel mesh

limber gyro
#

dude give us a general description of the idea

#

its easier

#

so only the host can change stuff?

#

how is that an issue?

rich ridge
#

Can host import anything during gameplay??

limber gyro
#

if only the host is making the changes i dont think that is going to bottle neck anything

rich ridge
#

Then use S3 or similar to store session based uploads

#

And once uploaded broadcast the S3 to clients and they download model from link and show

limber gyro
#

unless the host is making changes every second there should be no issue i think

rich ridge
#

And that is client doesn't have those static meshes

limber gyro
#

well but he said the issue has nothign to do with that

rich ridge
#

Before replication client needs to download those runtime meshes or assets

limber gyro
#

hes problem is with replicating strings

#

which i dont think is a problem at all in this scenario, if you had maybe 50 user all changing those strings at run time then yes, but it is only the host

#

theres no way its gonna bottle neck anything unless the host is sending half a bible each time

#

well, if the function is realiable it will probably just retry again like a TCP packet

#

i am not sure how the reliable stuff works in UE4 but i assume it is similar to a TCP protocol

rich ridge
#

If you persist the fbx model in S3 then upon reconnect your client will know which mesh or skel to show without asking the host.

limber gyro
#

so even if it jams it will go through eventualy although with a bit of lag

#

ye, the reliable stuff is a topic that i would like to know aswell

#

if you know any 1 at epic that knows about that stuff let me know

#

oh πŸ˜†

rich ridge
#

Using cloud storage will free the host to update the client every time clients connect... Thus host upload files and forget about updating to clients.

limber gyro
#

that would probably add aditional costs no?

rich ridge
#

Yes definitely πŸ˜…

#

EOS has player storage interface, but it doesn't offer 1:N access

#

So you can't use that one

limber gyro
#

you could call a MULTICAST when the host submits a change

rich ridge
#

It's not like you always need cloud storage .. you can also use CDN too.. I believe CDN is cheaper than cloud storage

#

And I think CDN is automatically cleaned up after sometime

limber gyro
#

i still think that the string replication wouldnt make that much of a diference tho

#

how realistic is it that you would have hundreds of models in a session?

#

even if you have that many could you simply not do distance culling?

rich ridge
#

Can host go offline? If yes then what happens?

limber gyro
#

it feels like you would need to replicate in batches, since its not a game it should be fine but i am not sure if UE4 can do that

rich ridge
#

I think @limber gyro is quite right.

#

Since you aren't using dedicated server, cloud storage won't make much sense

limber gyro
#

it would be more elegant that messing around with external servers

rich ridge
#

There is batch RPC, have a look at that too

limber gyro
#

but if you could do things in steps it would be ideal

#

oh there's batches RPc???

rich ridge
#

Yes

#

GAS uses batch RPC

limber gyro
#

whats GAS?

rich ridge
#

Gameplay ability system

limber gyro
#

oh

rich ridge
#

This doc is specific to GAS β›½

meager spade
#

its the same principle

limber gyro
#

man UE4 has so much shit, every time i feel like i have a small grasp on most systems something new pops up

meager spade
#

if you are going to send X amount of RPC's the same frame (from different things) you can batch them to a single RPC

rich ridge
meager spade
#

otherwise you want to maybe space out your RPCs on tick using some kinda timestep

rich ridge
#

I learnt about batch RPC from above link

meager spade
#

yeah Dave ratti replied to my post πŸ˜„

#

its how i do my weapon firing

rich ridge
#

And this man @meager spade

meager spade
#

i also batch Gameplay Cues to a single RPC for weapons

#

so i can send 3-4 cues through the system, but server will only ever do one 1 multicast RPC for those 3-4 cues

limber gyro
#

man i am so glad my game doesnt have to worry about net bottlenecks

#

small arena maps with 6 players tops

#

makes things so much easier

meager spade
#

still nice to reduce that stuff down tho

#

but my weapons originally was 3 rpcs per shot

#

till i batched them

limber gyro
#

ye i know, but since i dont have the experience/confidence/resources/time to dig into those systems i try to work around it by design

#

instead of having 10 shots per second i will have just 1

#

or if i have 1 character with 5 shots per second the others will have 1 shot every 2 seconds

#

its not ideal but i havent had any issues with replication so far

#

and i have my servers in playfab which are in the USA i play from portugal and tested with a guy from india

#

and we had like 30 ping

#

it also helps that the game itself is simple

#

anyways, i have a question, if i call an rpc from the level BP that damages all players if they are inside a specific are and i call it from evry client am i safe to assume that the damage will be multiplied by the amount of player in the game?

meager spade
#

i mean server just does the damage no?

#

so why do you need to rpc?

limber gyro
#

i was trying to understand how to achieve proper replication with level BP's but then Tank start with his issue and went from there lol

#

well the thing is i dont think it does

#

at least in the level BP

meager spade
#

i mean level bp is an actor

#

owned by the world

#

err server*

#

so why not just have server damage all pawns?

#

no rpc's involved

limber gyro
#

ok so heres where i am confused

#

i have a level that after X time moves all players to X location

#

if i do it in the tick that doesnt work

#

i have to do it in an RPC

#

for the player to actualy be teleported

winged badger
#

is confused what does one have to do with the other

limber gyro
#

thats why i am confused, i was under the impression that since the tick exists in both the server and client it would work without an RPC

meager spade
#

they should tho i wouldn't rely on that for timing purposes

#

client can tick later than server (by some margin)

limber gyro
#

well they should bu they dont xD

#

i will test again

#

just to make sure

winged badger
#

not in single process PIE

meager spade
#

in real world games

winged badger
#

but thats hardly a worthy test

limber gyro
#

why doesnt it work in PIE?

#

is it suposed to work in standalone?

winged badger
#

its single process

#

same tick drives them both

#

so

#

they tick at the same rate

limber gyro
#

ok so now it worked for some reason

#

bruh

#

but i am 100% sure i had issues with that

#

i think i didnt work in packaged version

winged badger
#

suspects sonicphi could benefit from a good night's sleep

limber gyro
#

hahahahaha

#

some times its the best solution

#

but seriously i am 100% it didnt work before

#

maybe i forgot something i dunno, happens some times

#

if i test this and it doesnt work without the rpc imma come back here and ask you both for my hour back cause thats how long it takes to upload stuff to play fab πŸ˜†

severe nymph
#

does anyone know how to transition from waiting post match back to waiting to start or inprogress even?

#

Once End match is called I can't seem to get ready for another match ... there doesn't seem to be a way to set the readyformatchstart bool

#

Match start transitions from waiting to start to in progress if called manually or "ready to start is true"

#

however UE4 documentation states nothing about Going from post match to reset other than "watiting on match is called after map load"

#

I don't want to reload the map

#

I want to force another round in the same session without traveling back to the same map
UPDATE************** It's not documented well but this page needs to mention that "Restart Game" will by default do all necessary things to progress back to "waiting on match start"

tranquil yoke
#

Hey guys, is there any heartbeat system already built in, inside Unreal networking, which we can use, i know server knows, if client has been disconnected, becasue of handshake it tries to do and also the, client timeout time.

summer tide
#

Any idea if I spawn this way, the client has no control. But If I directly get GetActorTransform then spawn, it works.

severe nymph
#

🀣

#

add questions to the sea of unanswered pile

#

lol

#

@summer tide btw

#

you don't have to -1 a get random int function

#

if you look at the cpp behind the function its 0 - max length

#

Actually its in the tooltip now

summer tide
#

Strange it seems it only gets one and I have 10 player starts.

#

three each beside the last one

severe nymph
#

Should be able to simply do this

summer tide
#

Why? I have a logic to check

severe nymph
#

Length of an array is the count from 0-9 (10) elements random int from that 0-9 - 1 will interate through all of them

#

the function handles the -1 for you

#

as specified in the tooltip

#

a random int from the max - 1

#

meaning it will radomly give you 0-9

summer tide
#

Yea I got that part, but Why Im only storing 1 transform of player start in the array.

severe nymph
#

because your getting the playerstart in the controller

#

Your also getting the playerstart on the server

#

why are you not calling a replicated to server event from the client?

summer tide
#

So I'm calling that event from game mode which I know runs on server only

severe nymph
#

Create you a function to get this

#

from output get actor transform and feed the spawnactorfrom class-> possess

#

you can run this in playercontroller but do it as a replicated from owning client back to server if owner

#

otherwise if server it runs (for listen client)

summer tide
#

So Owning Client Event -> Server Event; Server Event spawns the player?

severe nymph
#

In my gamemode I call init play(replicated to owning client if server) on the playercontroller

#

Then i call a (Run on server) which calls this get random spawn loc and possesses from that call

#

Event begin play can't be used really because it fires for the server and clients. I use handle starting new player in the gamemode

#

This way its seamless travel "safe"

#

wont cause issues down the road

#

The only thing I do off begin play in my controller is store the server gameinstance for vivox session IDs

#

Everything else is fired from the gamemode telling my controllers to init play

#

Which runs on the owning clients and request info from the server in the event the server needs to do something or give the client info

summer tide
#

Is this what you meant

severe nymph
#

no

#

In your game mode

summer tide
#

That's in my gamemode

severe nymph
#

oh

#

the switch node confused me

#

you don't need that

#

gamemode only exist on the server

#

there is no remote

summer tide
#

In controller ^

severe nymph
floral crow
#

When cooking on shipping mode, all my clients think they're in standalone mode and never even try to connect to the server. Is this normal behavior and I have to set some specific properties for clients to know they are clients? Or did I break the out of the box functionality somehow?

severe nymph
#

your game instance var for the server needs to be set on begin play

#

not on server spawn character

#

you'll be resetting your gameinstance var for every client join

summer tide
#

I do have one but for some reason it doesn't find it mayube that gets called before begin play

severe nymph
#

?

#

no

#

i think your checking for client gameinstance somewhere

#

Clients and server have thier own "gameinstance"

#

for clients you set gameinstance_c

#

on client init

#

"run on owning client"

#

for server you set gameinstance_s on controller begin play

#

if you want to get them seperately

#

otherwise you just got to understand how to call the get var behind "client side events" vs "server side events" and use valid checks

severe nymph
#

but the gameinstance is always there on begin play for the server

summer tide
#

So I store selected map name in my game instance fyi

severe nymph
#

Thats fine

summer tide
#

I can't use your random function i need to compare against the map name

severe nymph
#

why?

#

your getting all playerstarts

#

an object outputs

#

you can get the transform directly from there

summer tide
#

I renamed my player start to map, map 2, map 3, othermap, othermap 2, othermap 3, etc

severe nymph
#

wtf

#

lol

#

ok lets do this

#

lets understand what it is your trying to do

summer tide
#

Let's say I have 4 biomes

severe nymph
#

yeah

summer tide
#

each biome has 3 player starts.

severe nymph
#

at this point you create a "map" for each biome

#

you store the name of the boime in the playerstart

summer tide
#

All in a single world

severe nymph
#

you look up against that "map"

#

then get random from the lookup

#

BiomeName -> playerstarts

#

If you need flip the map around

#

make each playerstart unique but the description can be the biome (since the key does need to be unique)

summer tide
#

You think that's causing the issue that I'm having or this approach is better

severe nymph
#

I think you likely have something going on in that speggetti

#

I also think you have logic confused on how gameinstance works

#

gameinstances is local only

#

server cannot write to the clients gameinstance

#

the client has to set things based on what it knows

unkempt tiger
#

when determining what properties to replicate, how does UE4 check for equality (so it could delta serialize)? Do I need to override some operator like ==?

severe nymph
#

@summer tide

#

I'm not sure why your storing levelname in the gameinstance anyway

#

You can pretty much call this anytime you need to

#

Returns for both server and clients

summer tide
#

I should say biome name, since they are in a single world

severe nymph
#

ok got ya

#

So

#

when you get your random playerstart

#

and it picks an int

#

Just do this

#

it outputs the object and the playerstart tag name

#

you can use the playerstart tag for the biome name

#

and understand where your spawning

#

but here is the deal

#

if you set this "on the server thats spawning the pawn"

#

its just setting in server gameinstance

#

not the clients

#

you'll have run the set value in gameinstance on the client

#

if you want the client gameinstance to understand "where they spawned" then you'll need to call a run on owning cllient to set the biome name there in "the clients gameinstance"

meager spade
#

you have to have that RPC in the player controller tho

#

GameInstance cant do RPC's

severe nymph
#

yeah i just found out what he was trying to do

#

lmao

#

hes trying to pull gameinstance info from the client to look up and use on the server to spawn

#

and yeah he's not rpcing on gameinstance

#

its in the playercontroller

summer tide
#

I fixed my logic, I had the contains param input reversed. Now trying to fix the replication issue. So I need to save the transform on client side as wel as you mentioned

severe nymph
#

Well

#

You have to understand that you'll need to get the transform from the client to spawn on the server if thats your intention

#

are you trying to "save" where they spawn basically?

summer tide
#

Not save I mean store the transform of the player starts in a variable

severe nymph
#

why?

summer tide
#

Oh wait let me implement your function first

severe nymph
#

if your only using it to store playerstarts then do it on init play or on the server begin play

summer tide
#

oh that will work then let me do that

severe nymph
#

but the honest truth is storing an array of playerstart objects is likely more future proof

#

you can get transfrorm, start tag, actor tags, etc

summer tide
#

I can only use GetActorOfClass to get the player starts how else you do that

severe nymph
#

The reason i do it from a function is my playerstarts "move"

#

so i get them on init play on controller from gamemode

#

but if yours are static you can literally build the array and store the var on begin play

#

The only reason game instance needs to know is if you want to save it across levels

#

or dump it to a save file

#

I have a checkpoint function that destroys the playstart and spawns a new one for progression "since unreal won't let a playerstart be movable"

#

still something I think is goofy

summer tide
#

So If I add transform in begin play. THe server doesn't spawn only client does. I screw up something?

#

So in ctrl , Owning Client Event calling the Server Event and Server event is spawning.

severe nymph
#

huh?

#

are you getting from controller or gameinstance?

#

if your storing in game instance and then pulling then thats why

#

like i said you can't cross talk

#

each client "including listen server" only has access to thier own instance

winged badger
#

@severe nymph i am fairly sure you can attach the PlayerStart to another Actor then teleport that Actor around

severe nymph
#

@winged badger ok awsome

#

thats a nice tip haven't tried it

#

i only tried to teleport the actual playerstart actor

#

tried set actor location too

winged badger
#

i don't remember what im doing exactly anymore

#

but PlayerStates have the same base, Ainfo

#

and i do attach mine to my Pawns just fine

summer tide
#

So Uno where should I store the selected map anme if not game-instance

severe nymph
#

your boimes are server info

#

your server understands them

#

your playerstarts again should be an array you build

#

objects

#

event begin play get all actors of class add to array

#

boom

#

playerstart array populated

#

in the server spawn logic you spawn the client from the transform you want them to spawn at

winged badger
#

that apporoach is suspect

severe nymph
#

if you want to match the biomes you save a gameinstance var = serverside var

winged badger
#

FindPlayerStart is usually called way before BeginPlay

#

and there is the matter of AGameModeBase::ShouldStartAtStartSpot as well

severe nymph
#

what?

winged badger
#

which makes controllers pick a cached StartSpot

#

that they cached immediately upon loading a level

severe nymph
#

this is in playercontroller

winged badger
#

without any info from lobby

severe nymph
#

its litterally comes in after map load

#

before posession

#

not talking about on level begin play

winged badger
#

its the same thing

severe nymph
#

not talking about gamemode begin play

winged badger
#

they get called together

severe nymph
#

what?

winged badger
#

is way too late

severe nymph
#

Um not according to everything I've ever done

winged badger
#

that is wrong

#

with GameMode

#

StartMatch calls DispatchBeginPlay

#

which is when world calls BeginPlay on all Actors in it

severe nymph
#

Um.. they have tools you can run that state otherwise and also editor vs standalone has a different order call

#

so you might be getting things confused there

winged badger
#

i literally know that source code like the palm of my hand

severe nymph
#

I can promise you

#

if you print event begin play in a map and on a playercontroller you'll get the map first 99% of the time

#

if not 100%

winged badger
#

doesn't matter in which order the Actors call BeginPlay in

#

literally not one bit

severe nymph
#

it does whenever the map load completes and all starts are loaded

#

before the freaking controller calls build an array of the object

#

order of operations is indeed the topic here

winged badger
#

and you have to cover the following 2 scenarios

#

1 - intentionally delaying BeginPlay

severe nymph
#

a thing you don't have to do knowing order of operations

#

but sure

winged badger
#

which is very very common, especially with seamless travel that Korvax uses iirc

severe nymph
#

go ahead

#

I use seamless

winged badger
#

2 - after seamless travel, unless the PC class changed from departing to arriving map

severe nymph
#

I don't delay begin play

winged badger
#

PC won't call BeginPlay

severe nymph
#

because its done "right"

#

yes it will for the server

#

not for the clients

winged badger
#

its the same instance

severe nymph
#

that why you have a gamemode client side call

#

intit play from handle starting new player

winged badger
#

so

severe nymph
#

and by now i feel like you just want to debate

winged badger
#

you seamless travel

severe nymph
#

I'm good

winged badger
#

first thing a departing controller calls when arriving on target world

#

is NotifyWorldLoaded

#

then it calls ServerNotifyWorldLoaded

severe nymph
#

i was here to help and i've been doing this long enough to know that when someone says "intentionally delay begin play" they have bigger issues

winged badger
#

that calls HandleSeamlessTravelPlayer into GenericPlayerInitializations then into HandleStartinNewPlayer

#

if you are doing anything like overriding ReadyToStartMatch (so you can wait till all travelling players loaded)

#

to say, return NumTravellingPlayers == 0;

#

your entire setup explodes

severe nymph
#

Or you can just tick delayed start and handle it manually

#

but sure

#

I do things the right way based on I have my own functions before just letting the gamemode fire off match logic

winged badger
#

what we do is procedurally spawn 30k actor level on server and client separately

#

then we network actors after the fact

severe nymph
#

the functions themselves literally say "you should override"

winged badger
#

and then we let BeginPlay get called

severe nymph
#

The point being here... that for him the server needs a collection of playerstarts (array)

winged badger
#

if you have preplaced player starts on the level

severe nymph
#

the map is loaded for the server and begin play is called for the server controller afterwards

#

he can build it there

#

just fine

winged badger
#

you can just override PreSave on custom LevelScriptActor

#

to stash them in an array in editor time

#

and not having to search one single thing at runtime

#

BP equivalent would be putting all PlayerStarts in LevelBP's array

severe nymph
#

hes struggling with reading from a client gameinsatance to match the server biome name

#

and your trying to offer him this advice and crap on loading an array in begin play ... sheesh man

winged badger
#

that was your advice, and it was bad

severe nymph
#

its like einstien trying to teach relativity to a 9 year old

#

he's gotta crawl

#

then walk

#

then run

#

again my advice isn't bad

#

its simple

#

and honestly there are thousands of youtube videos from UE staff offering much worse advice

#

or simply not understanding things

winged badger
#

epic MP tutorial supposedly has replicated array of PlayerCOntrollers in GameMode

severe nymph
#

btw

#

If its wrong

#

Tell epic to update thier docs

winged badger
#

this is GameModeBase

glad sedge
#

Epic's docs is like patriotism or religion. They live in your heart.

winged badger
#

possibly, can't say i use it

#

GameMode has few subtle differences

#

and those docs are made by same people who make tutorials you mentioned above πŸ˜›

severe nymph
#

This is the gameflow chart that shows order of operation differences between editor and standalone

#

if you print from each you will get this output today

#

I literally live by this and the Network_Compendium

winged badger
#

my problem with this is

#

with AGameMode

#

StartMatch is the first in blue column

severe nymph
#

what? no it isnj't

#

beginplay in gamemode gets called way before startmatch

#

startmatch without any changes occurs litterally right after begin play the readytostartmatch bool returns true and then the matchstatechange event fires

winged badger
#

and you're printstringing all of this in editor?

severe nymph
#

no

#

but wouldn't matter

#

after egine start this order is the same

#

the only difference being in PIE you can't test server travel

winged badger
#

ending start order doesn't matter, only what happens after world loads

#

for this discussion

severe nymph
#

but order after UWORLD is the same in standalone and editor

#

get a bland project and test it

winged badger
#

and i never said it wasn't

severe nymph
#

its easy

winged badger
#

put some breakpoints in, walk through the source code as it executes

severe nymph
#

gamemode calls right after UWORLD

#

startmatch can't be called on a null ptr

#

its exist in mode base

#

I understand it

#

i don't need to put breakpoints

winged badger
#

not as well as you think you do

#

anyhow, work in 6 hours

severe nymph
#

there is no way that a delegate that exist in a class gets called before the class contructor

winged badger
#

and this is pointless, as you need to unlearn few of your assertions

severe nymph
#

but doesn't matter

winged badger
#

so, good night

severe nymph
#

I'll record a video printing it out

#

after i've posted the docs

#

source states the same thing

#

if it doesn't then you show me

#

explain to me how a function and delegate that exist within a class can somehow get called before its contructor

#

thats like saying a component tick can start before its part of an actor

#

the "source" actually proves you wrong

#

yeah thats what I said its a member of gamemode ... its called after the constuctor after the pointer ... after the class init

#

UWORD-BeginPlay-> Gamemode->Constructor->Startplay->Startmatch

#

that has nothing to do with what we are talking about

#

And yes i came to the conclusing zlo wasn't on the same page a while back

glad sedge
#

Dumb q, but I assume people roll their own network code - i.e. a custom movement component w/ no network code.

severe nymph
#

but he was determined to correct me on this other thing anyway

#

Put it like this

#

the day he can get gamemode begin play to fire after start match

#

I'll give him a million bucks

winged badger
#

the point was, PlayerController, and every Actor can end up calling BeginPlay a full minute after all the PlayerPawns are spawned at their PlayerStarts

severe nymph
#

a pawn doesn't need a playercontroller

winged badger
#

including the GameMode

severe nymph
#

thats dumb

#

of course that can happen

#

but gamemode will fire

#

and will begin play

#

well before match start

#

and controller will also fire after map load

#

regardless of possession

#

and honestly i'm simply waisting my time now

#

this conversation is no longer constructive

#

I simply value my time too much

winged badger
#
void ARTS_GameMode::HandleMatchHasStarted()
{
    GameSession->HandleMatchHasStarted();

    // start human players first
    if (!ShouldShowHeroSelectionMenu())
    {
        for (FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator)
        {
            APlayerController* PlayerController = Iterator->Get();
            if ((PlayerController->GetPawn() == nullptr) && PlayerCanStart(PlayerController))
            {
                StartPlayer(PlayerController);
            }
        }
    }

    // Make sure level streaming is up to date before triggering NotifyMatchStarted
    GEngine->BlockTillLevelStreamingCompleted(GetWorld());

    // First fire BeginPlay, if we haven't already in waiting to start match
    GetWorldSettings()->NotifyBeginPlay();
severe nymph
#

if anyone else needs help without someone jumping on my help @ me

winged badger
#

last line is where the world starts calling BeginPlay on Actors

#

which is after SetMatchState(InProgress)

severe nymph
#

cause apperently the first person to make a dent in the sea of unanswered is only here to catch crap

winged badger
#

and then comes AGameMode::BeginPlay

severe nymph
#

nobody is talking about that zlo

#

actors come later

winged badger
#

SetMatchState(InProgress) is also called from StartMatch

severe nymph
#

again off topic

#

Here is the docs

#

its right

winged badger
#

for my part i will admit i did not know the function in the World was also called BeginPlay

severe nymph
#

spawn actors of course is after startmatch

winged badger
#

GameMode still can't call BeginPlay before it starts the match

severe nymph
#

now your spinning off in another direction

winged badger
#

nor can any World Actor

severe nymph
#

yes it can

#

gamemode calls beginplay before match start

winged badger
#

put some breakpoints instead of reading print strings backwards, please πŸ˜›

#

now, good night

#

PS. UWorld::BeginPlay() != AGameMode::BeginPlay

severe nymph
#
LogBlueprintUserMessages: [DeathMatch_GM_C_0] Server: BeginPlay```
winged badger
#

so it started the match

#

then called beginplay

severe nymph
#
LogGameMode: Display: Match State Changed from WaitingToStart to InProgress
LogBlueprintUserMessages: [DeathMatch_GM_C_0] Server: BeginPlay```
winged badger
#

you're now making my point for me

#

unliek print sstrings

severe nymph
#

yes ... apparently in 4.26 preview

winged badger
#

logs read top down

severe nymph
#

or without delayed start

winged badger
#

and BeginPlay being the last one to be called is an extremely powerful tool

severe nymph
#

The delegate for echanged match state fires before beginplay

winged badger
#

as you can control when it is called

severe nymph
#

so the docs are wrong

winged badger
#

technically, yes and no

severe nymph
#

well i'm not one to not get a lession or be too stubborn to learn

winged badger
#

World is not an actor

severe nymph
#

so thanks zlo for pushing at me

#

i appreciate it

winged badger
#

so it does call its BeginPlay function first

severe nymph
#

heheh

#

was only trying to help but apparently caught a lession myself 😊

#

πŸ˜›

#

my bad zlo ... seriously

#

so used to using delayed start or readytostart override ... i haven't tested vanilla behavior on gamemode in a "long" time

#

I was ready to lose money on it πŸ˜›

winged badger
#

no harm done, and we all learned a bit from it, i'd say

glad sedge
#

The true lesson..

#

was humility.

#

If I'm getting into making my own lil Network code for UE just for shits and giggles, is there a good resource to learn from?

severe nymph
#

@winged badger maybe you know better for this

#

say i want to disable input for all clients until after match start

#

how would you handle that?

winged badger
#

how cheat proof?

#

if the answer is "very" only thing you can do is unpossess

#

everything else can be hacked client side

severe nymph
#

The way I was doing it now I was getting the new player waiting until posesssion is relevant and calling disable input from gamemode

#

basically I want them just standing there able to look around and stuff but not move

winged badger
#

if the game is competitive

severe nymph
#

I don't want to handle spectating

winged badger
#

i'd go with spectators

#

yeah...

severe nymph
#

its a VR game

#

i'd rather not

#

I also don't like promoting the fly around and "private chat"

winged badger
#

it is at risk of cheating?

severe nymph
#

Well ... I just find ppl take advantage of spectating too much

#

unless you really limit the spectator

#

at that point I simply spawn them still in their characters

#

not deal with the extra class

winged badger
#

which is easier to do then limit CMC< especially from BP

severe nymph
#

I really need disable input

#

limiting movement on the movement component doesn't keep them from gripping

winged badger
#

swap the input components

severe nymph
#

"i have climb"

winged badger
#

have one for the start

#

that allows few things you can do while waiting

#

and then swap it for the "real" one

severe nymph
#

Thats actually a pretty good idea

#

I'll look into that

limber gyro
#

using a "is server" node in a level BP would be the same as "has authority"?

#

since the map actor is spawned on the server it should be the same right?

winged badger
#

its not spawned

#

its loaded from the package

#

but yes, it would be same

limber gyro
#

is "is server" the same as "#if ue_server"?

winged badger
#

no

#

its GetNetMode() != ENetMode::NM_Client

limber gyro
#

ty

winged badger
#

preprocessor directive to compile things only for server targets has nothing to do with it

pallid canyon
#

I think I've got enough eggs in a row to make the dive but I wanna see if this doesn't pass the smell test to anyone of you smarter people here:

Using the oculus online subsystem I can handle creating sessions/inviting people/yada yada. Then using the awesome tutorial by Flopperam I can setup a fleet that would be on the receiving end of those create/join session calls yea?

#

Are there any super unique gotchas specifically trying to implement oculus online subsystem this way? Seems relatively... straight forward (I'm gonna regret those words)

somber glade
#

if a server function spawns sound at location or spawns sound attached, that will be heard by all clients correct?

severe nymph
#

incorrect

#

if that sound is in the world basically then you will hear it (attached spawned by server)

#

if you spawn sound at location replication isn't handled

#

you'll have to multicast it

somber glade
#

okay..so spawning a sound is different from spawning an actor?

severe nymph
#

yes

#

sounds and emitters etc are client side effects

somber glade
#

I'm thinking more in a context of a listen server where we'd want/need the host to also see/hear these effects

severe nymph
#

its the same

#

listen server just has a client

#

but replication if done correctly can transition from listen server to dedicated without much modification

#

basically if you place an audio actor in the level its part of the map

#

net load on client

#

by default

somber glade
#

but if you spawn it, you need to multicast the spawn

severe nymph
#

meaning clients hear the sound

#

if you spawn the sound attached then it attaches to a netload on client actor

#

usually resulting in all clients hearing it if its on an actor in your world

#

unless that actor isn't replicated at all

#

then no

#

you won't hear it

#

also with UE4 it depends alot on what drives these events

#

if its overlap or hit

#

some delegates are already "fire on all"

#

a hit for example

#

doesn't need to be replicated

#

it fires on all

#

it will send logic down the chain on server/clients for that hit

#

if you place a spawn sound node there

#

then there is no need to rep

somber glade
#

okay.

#

that makes sense.

#

I just didn't realize that spawn sound wouldn't automatically replicated like a spawn actor

severe nymph
#

well ... an actor with replicates and net load when spawned is handled ... if you spawn a sound or atttach a sound component to that actor it's usually handled but that isn't the case for at location or attached "in general"

#

alot depends on whats calling the logic ... the type of event firing, if you want it in sync ... if its a state or a fire and forget (multicast)

somber glade
#

Right now it's a weapon sound attached to a barrel, I want to make sure the sound follows the barrel as the players are moving quickly and the sound isn't entirely instant. So I don't want to use "play sound at location" so I thought if I spawned it attached it would move with the actor, and then I could bind and destroy it when it was done.

#

but I'll have to spawn it on the host and then multi spawn it on the clients. which is fine.

#

just good to know before I test it and scratch my head wondering why it wasn't working

severe nymph
#

well

#

I usually don't use replicated projectiles

#

I multicast them

#

I spawn a local copy

#

and the sound

#

then multicast out to everyone but self

somber glade
#

hit scan, not projectiles.

severe nymph
#

same concept

#

line trace on client rpc to server multicast from server to all but self

somber glade
#

and this is the firing sound, not the projectile sound itself.

severe nymph
#

have an event called Local

#

call it spawn sounds do stuff etc

#

call a server event that calls it

#

then multicast it

#

to everyone but self

#

all but owning client

somber glade
#

okay I'll try that. Thanks.

severe nymph
#

this also negates the feeling of lag

#

otherwise every client is going to feel this latency and hear things late etc

somber glade
#

but on normal architecture, isn't weapon firing done through the server?

severe nymph
#

of course it is

#

your hits are going to be coming from the server

somber glade
#

but isn't even pulling the trigger itself done through the server?

severe nymph
#

no....

somber glade
#

most examples I've seen of this have your weapon fire input directly connected to a server call to fire the weapon

#

because the client has to check with the server to make sure it can fire the weapon at the time.

#

So as not to bypass fire rates or anything like that.

severe nymph
#

lol

#

you been watching too many "old epic tutorials"

#

but no

#

an input event comes from controller index 0 for every local client

#

and directly controls the possessed actor

#

only if that actor is a character and has a character movement component does it do things like client prediction

#

only if the actor is replicated can you even look at things from a server or rpc standpoint

#

the switch has authority node will actually branch your logic on server (authority) / remote(client)

#

if everything went through the server first then there wouldn't be a need to branch off this

#

or even have a method of understanding the logic control

#

"net load on client" is actually another tell that when you wrap your head around it explains that the client has a copy of "these actors"

#

they exist both on the server and the client and you control the state/sync with rpcs/replication/rep notify

#

If you told your logic to do everything on the server side then your clients would be waiting around forever to see things like sound effects or bullets "120ms" of latency feels horrid if your waiting around that long for everything

#

so you do things locally now and you keep your fingers crossed that the server (agrees with you) then if it doesn't it corrects you

somber glade
#

and then you have players complaining "my screen showed me shooting them but no damage registered".

severe nymph
#

yes

#

but you'd rather that complaining

#

believe me

#

ppl complain about rubber banding

#

but they would rather that

#

than a big ass 120 to 200ms delay between pressing forward and walking

#

its why UE4 actually has this built into the CMC

#

its also why on fortnite or Unreal Tournament you see exaclty that situation where lag kicks someones rear end and they swear on their screen they shot someone but the server corrected them

#

I don't think anyone actually "waits on the client side" for a response from the server for most things.... they check back for a "correction state"

#

some things you will want to branch off authority on "damage" "hits" "overlaps" etc

#

then you'll multicast out

#

but input events

#

hell no

#

fire that anim

#

fire that sound

#

on hit squirt that blood

#

then athority check then multicast

#

for everyone except local for effects

somber glade
#

I've played games like that they were garbage. You run up behind someone shoot them several times in the back over 2 seconds then they turn around and shoot you once and you're dead

severe nymph
#

ok ... i'm just trying to help

meager spade
#

heh welcome to Latency

severe nymph
#

I've also played games where i fire and it takes 2 seconds to see an animation or get feedback

#

and its garbage

meager spade
#

no way to fix it, just have to work around it

somber glade
#

and the way you're suggesting is equally garbage.

severe nymph
#

nope

#

been doing it a long time

#

its called client prediction

#

its built into UE4 CMC

meager spade
#

Fortnite all weapons fire on the client, server is the only thing that applies damage. Same as overwatch, and mostly all competitive games.

severe nymph
#

πŸ‘†

meager spade
#

Same as movement, its all predicted

#

players want instant response, having a delay before they get an action is terrible

somber glade
#

and having actions mean nothing is also terrible

meager spade
#

sure, rubber banding and missed shots is a pain, but its better than you shooting then die without seeing your gun fire.

somber glade
#

it's no different than seeing your gun fire and them not die and then you die.

#

it amounts to the same thing

meager spade
#

so whats your proposal?

#

upgrade everyones internet to light speed

#

?

somber glade
#

if both options are shitty don't act like one is better than the other when it isn't.

severe nymph
#

hes saying its better to just make no input register until the server replies

meager spade
#

server firing the weapon is a lot worse

#

trust me.

severe nymph
#

he saying not to use client prediction at all

#

at least a correction can come across eventually sheesh

meager spade
#

why would companies spend money and years of dev work on prediction and stuff?

severe nymph
#

but just waiting

#

... thats like the 90's

somber glade
#

Don't put words in my mouth.

severe nymph
#

quake2 wishes they had client prediction

#

carmack went ham on the "dream" of it

somber glade
#

I've played games that have both and they're equally crap unless you've got a AAA company behind them can afford local servers for everyone.

meager spade
#

even with local servers

severe nymph
#

that "rail gun" to ping ratio

meager spade
#

there is latency!

severe nymph
#

haha

meager spade
#

still have to go through a server

severe nymph
#

not in UE4

#

RTS has some of the worst latency

meager spade
#

predicting damage is also terrible

pallid canyon
#

Civ latency makes me cry

meager spade
#

seen games where you see them get damaged, then half a second later, boom they have full health πŸ˜„

severe nymph
#

the game thread is usually eating it

#

but i've yet to see an rts under 11ms

meager spade
#

how is latency linked to gamethread?

severe nymph
#

maybe runing on a 3090 being devved for apple

meager spade
#

o_0

severe nymph
#

latency comes from everywhere but yes... net latency comes after the stat unit/fps/ai and general overhead

#

but most RTS games even local can feel like dog poo

meager spade
#

err

#

ok?

severe nymph
#

no its not

meager spade
#

i mean if your gamethread is at 100ms or something sure

#

then it may not push net updates

severe nymph
#

but overall feeling of responsiveness is

meager spade
#

but latency we are talking about is the client <> server

severe nymph
#

yes specifically yes

#

I might have misread the comments and thought we were getting off on general game performance

meager spade
#

but yes they all play a part performance is also key

#

faster those RPCs and Netupdates go out, the smoother also

#

but your biggest bottleneck for client <> server is always the connection, and distance from the server.

inner sand
#

quick question about replication, if i set a variable to not replicated can the server access it and change it,the variable is in the player pawn, I am trying to have it not share with the client.

meager spade
#

ofc

#

anyone can change

#

a replicated actor exists on server and all clients

#

(well kinda, but in general)

inner sand
#

ok if the client doesnt need to know the values of a certain variable

meager spade
#

net relevancy plays a part in that

#

if its server only and only used on server, you can wrap it with #WITH_SERVER but everywhere you use it must also wrap it.

#

else just leave it not replicated and only change it and read it on the server

inner sand
#

got it

#

thanks!

lament flicker
#

I created my own OnlineSubSystem as a Plugin, put it in the plugin folder... now when launching the client cant find that subsystem

#

LogOnline: Warning: OSS: TryLoadSubsystemAndSetDefault: LoadSubsystemModule([OnlineSubsystemEthos]) failed

#

LogModuleManager: Warning: ModuleManager: Unable to load module 'OnlineSubsystemEthos' - 0 instances of that module name found.

#

Is there something Specific I need to add it to the search path or module loading path?

rich ridge
#

@dull lance I guess there is no detailed documentation on this.. you will have to explore GAS β›½ system to get full understanding of batch rpc

kindred widget
#

πŸͺ›

#

Haha. I'm sure they exist somewhere.

steel vault
#

I feel like I spend more time reading the multiplayer discord channel to learn things than I actually spend working on my game these days... Help.

vivid seal
#

any idea why OnRep_Pawn inside the PlayerController class is getting called twice per client? I wanted to use that as a place to call a Blueprint Event for clients to set up their UI, but i'm getting duplication. every client calls it exactly twice at the start of the game

#

nvm, i'll use AcknowledgePossession instead I think

shadow schooner
#

hello I asked yesterday but I went offline

#

how can I save replicated values from a level to another with blueprints?

#

I didnt quite understand the thing with saving into playerstate

rich ridge
#

@shadow schooner what kind of values you want to save?
Are they fundamental types or custom types?

shadow schooner
#

variables sorry

#

replicated variables

rich ridge
#

Just declare.

UPROPERTY(Replicated)
int Level.

Inside your PlayerState

shadow schooner
#

that differ from each player

#

and also I am using blueprints

rich ridge
#

do this in PlayerState

#

for each player they will have their own variables in their PlayerState

shadow schooner
#

so if I have like 10 players

#

I should have 10 different variables?

rich ridge
#

no

#

class MyPlayerState{
UPROPERTY(Replicated)
int kills
}

shadow schooner
#

i did something like that

#

a replicated player state

rich ridge
#

every player have their own copy of player state

shadow schooner
#

and I have the variables I want

#

and I have this

#

but when I servertravel every variable value for every player sets to default

rich ridge
#

ohh I see now

#

you need to persist those values in PlayerState

#

he is not using c++

empty axle
#

oh

#

CopyProperties is exposed to blueprints

rich ridge
#

i guess no

empty axle
#

it is

rich ridge
#

then he can do it

empty axle
rich ridge
#

yes right

empty axle
#

just copy from current player state to the new whatever you like

rich ridge
#

just set your variables value in NewPlayerState and you are done

#

and make sure those variables are exposed to blueprint too.

#

class MyPlayerState{
UPROPERTY(Replicated, BlueprintReadOnly, EditAnywhere)
int kills
}

#

something like this

shadow schooner
#

how do I persist?

#

also can I ask

#

should I use blueprint or code whats better?

winged badger
#

good balance of blueprint and code is best, but i would personally recommend doing all network code in c++, as blueprint has very few tools available

shadow schooner
#

and how can I learn replication and networking better in depth. Only from the docs or there are good tutorial,videos or even powerpoint presentations?

shadow schooner
#

damn

#

that seems pretty great

#

thanks so much

winged badger
#

@shadow schooner always good to check pinned messages on channels when looking for resources here

shadow schooner
#

but isnt that doc supposed to be a little bit outdated?

winged badger
#

there are newer network features

#

but those documented have not changed

shadow schooner
#

oh okk

thin stratus
#

It could be a littttttle bit outdated, but this are mostly the basics and they will probably never change.