#multiplayer

1 messages ยท Page 598 of 1

thin stratus
#

Which are like Party Sessions

shrewd tinsel
#

thank you @empty axle and @thin stratus

gusty slate
#

By the way @thin stratus, are Beacons a solution to implement a Party system for matchmaking/etc in main menu like PUBG/Fortnite/Rocket League?

thin stratus
#

Yes

shut gyro
#

Specifically, Paragon used PartyBeacons to implement reservation systems so that people could queue into party sessions without joining them if they get full all of a sudden.

gusty slate
#

Thank you ๐Ÿ‘

gusty slate
#

Is there a way to use the SpectatorMode and states and still be able to allow the player to attach/follow other Pawns?

#

a simple AttachActorToActor isn't working

gloomy sedge
#

If I have my Dedicated server exe running, and I play Standalone from the editor after editing something in BP, Should I still be able to connect to the server? or would I need to RePackage the game?

fervent spoke
#

does anyone know for a fact if NetConnection's AvgLag is roundtrip time

#

i would assume so but it could be half that

#

and i don't have a convenient way to test right now

bitter oriole
#

It's lag time

#

So half ping

fervent spoke
#

ah

unkempt tiger
#

Is there any function like OnConstructionPostNetSerialize that I can use to load and cache some data of mine?

winged badger
#

there be PostNetInit and PostNetReceive

unkempt tiger
#

thats some good stuff, thanks @winged badger ! Is there a PostNetReceive for structs? hmm

round star
#

Can not for the life of me get the dedicated server to show up in th steam server browser

winged badger
#

its for actors

twin star
#

Anyone here happen to be good with networking and knowing how to calculate IP addresses?

eternal parrot
#

I thought VOIP requires sessions.

thin stratus
#

It needs some sort of connection. Sessions are just info.

eternal parrot
#

Is the default VOIPTalker going to work without sessions? I just want the players to be able to talk to each other on a dedicated server. I use steam subsystem, but not steam networking.

silent valley
#

@eternal parrot you must be in the same session for the built in VOIP to work I'm afraid.

#

You might be able to hack it with engine modifications.

limber gyro
#

having a bit of an issue with a client function

#

so i have a client function that spawns a niagara function, very simple

#

i call it inside a server function that is triggered on damage taken

#

my logic is that since that server is being called in the server then it would be correct to call a client one from the server

#

client function:

#
{
    UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), bloodParticles,GetActorLocation());

}```
#

heres the server function

#
{

    if(isDead==false && isInvunerable==false)
    {
        OnDamageTaken();
        SpawnBloodEffect();
....```
#

this is being called in the character class and i have confirmed with a break point that the SpawnBloodEffect function is being called

winged badger
#

blood effects don't need to be super accurate, usually

#

and also, client is notified it took damage

#

so why the separate RPC?

limber gyro
#

well, if i call the effect in the server it wont spawn in the client right?

winged badger
#

point it

#

blood effect is atomic to getting shot

#

if you have the fact of getting shot networked

#

you don't need separate networking for blood effects

limber gyro
#

i could call it on a change of HP but i am not sure if i want every hp change to be represented with blood loss

#

but still

#

isnt this suposed to be working?

winged badger
#

no idea

#

can't even tell if its a server or client function from above

limber gyro
#

but what do u mean, "the fact of getting shot"

#

first one is client, second is server

winged badger
#

that would only work on owning client

limber gyro
#

the take damage is only running on the server so the player doesnt know

winged badger
#

when it takes damage

#

but not when it inflicts damage

limber gyro
#

????

#

i am not following

#

where do you think i should put the function?

winged badger
#

ideally you'd simulate the entire thing

#

you somehow replicate shots

#

or the fact that you are shooting at very least

limber gyro
#

but when other players shoot it needs to be seen too

winged badger
#

so there are hits being made on clients, you just choose to inflict damage on server only, which is fine

#

but clients can calculate their own shots and spawn blood effects themselves

#

without waiting for server to tell them to

limber gyro
#

i am doing all that on the server tho

#

i spawn all the bullets on the server

winged badger
#

that makes the whole thing feel a little bit unresponsive

#

but if bullets are replicated

limber gyro
#

so far that has not been the case

winged badger
#

they can resolve hits client side as well

#

and apply blood effects when they hit

limber gyro
#

yes but damage is not limited to bullets

winged badger
#

minor edge case where client would hit and server misses so client has extra spurt of blood

#

doesn't really matter in the grand scheme of things, health still stays in sync

limber gyro
#

theres stuff like poison which does dmg overtime

winged badger
#

which is also replicated

#

separately

#

and can trigger particle or w/e effects when it is, locally

#

no need to send an RPC for that either

#

smoke&mirrors

#

if i spawned bullet actors on server and replicate them

#

my game would die in less then 5 seconds

limber gyro
#

i am aware that i can check the HP for example to spawn the blood but it just feels sorta weird since it feels like i would lose control and it would be a bit "hackish"

winged badger
#

actually

limber gyro
#

well, my game has 6 players per server

winged badger
#

it would look better

limber gyro
#

so theres nothing to worry about

winged badger
#

server spawns the bullet

#

bullet is replicated, correct?

limber gyro
#

yes

winged badger
#

so

#

that bullet flies in generally the same direction at the same target on client and server, yes?

limber gyro
#

yes

winged badger
#

so if you were to let bullet collide with the target on client, what happens?

limber gyro
#

that is all fine and dandy but i dont deal damage only with bullets

#

that would work if the game was only based on bullets tho

winged badger
#

you also don't spawn blood effects from poison

limber gyro
#

why not

winged badger
#

and the bullet hit in production would look different

#

then any other blood effect

limber gyro
#

they serve as visual cues for whats happening to the enemy

#

i have a spinning chain around players to represent a root effect so i might just go with blood on everything

#

also theres AOE kind of spells that will do dmg and they will need the blood effect 100%

winged badger
#

but again, you have the explosion actor replicated for those

#

or something similar

#

that can do their own blood effects client side

limber gyro
#

true, but i would have to call it every time i code a new character

winged badger
#

thing is if you have a visual cue on client that it suffered damage, you probably replicated what caused it before that

limber gyro
#

i might just go with the HP change

winged badger
#

and you can absolutely overload the network with 6 palyers

limber gyro
#

feels kinda "meh" of a solution thp

#

tho''

#

i can?

#

please tell me more about that

#

i dont wanna get caught with my pants down

#

i am not replicating much stuff now

winged badger
#

we have 8 players, with 2000 interactable actors, 150 active AI and listen servers

limber gyro
#

well we have 6 players xD

#

period

winged badger
#

we had to do some heavy optimizations

#

for that to work

limber gyro
#

what are you working on if i may ask

winged badger
#

because of the sheer number of actors

#

The Red Solstice II

#

it has a steam page

limber gyro
#

how far from realease are you guys?

winged badger
#

less then 6 months

limber gyro
#

how big is the team?

winged badger
#

12ish + few people on the side when needed

limber gyro
#

i assume the first one sold well

#

for you to be making the second

winged badger
#

golden rule is, never replicate anything you can infer on client from the data you already replicated

#

especially via RPCs

limber gyro
#

i will keep that in mind

winged badger
#

bandwidth is the 3rd most likely chokepoint on the network

limber gyro
#

its my first dance with multiplayer so...

#

i take all the help i can get

winged badger
#

after overflowing the RPC buffer and having too many Actors considered for replication

limber gyro
#

RPC's have a buffer, i didnt know that

#

thats good ot know

winged badger
#

everyone obsesses about bandwidth

#

and that part of the networking is actually difficult to fuck up

limber gyro
#

i rly should read the docs, but i get bored easily haha

kindred widget
#

I assume that's why the GAS uses stuff like the RPC pooling. Saw Kaos talking about that the other day. I will look at that system someday. Maybe.

steel vault
#

@winged badger game looks amazing btw.. great work

winged badger
#

@heady beacon is responsible for most of the fancy kabooms you see there

steel vault
#

Team is clearly incredibly talented. The VFX scream AAA.

distant talon
#

how do you approach rpc buffer problems (diagnosing, knowing you even have one, etc)? I feel like this is information that should be documented somewhere

twin juniper
#

is there a difference items are placed on a map opposed to when an item is spawned on the server?

fossil spoke
#

@distant talon You can use Unreal Networking Insights to profile your network usage during Editor sessions.

distant talon
#

we've had problems in the past that were solved just by going through and optimizing rpc call counts using the network profiler. I dont think there was anything that (at least recognizably) jumped out as "rpc buffer problem" though, is there a tell?

fossil spoke
#

Well you should be seeing high send rates of lots of data if its being overflowed.

#

Make sure your not calling Reliable RPCs on Tick or something silly like that.

#

Avoid Multicasts as well.

#

Multicasts tend to end up flooding the buffer if not utilized correctly.

#

Since they have a maximum limit per connection i think.

#

Thats quite low.

gloomy sedge
#

Hi, I've been struggling with dedicated servers for a couple days now, I posted a question in here earlier about opening level with the ip and someone said, I forget their name mentioned that i do not need to use this as the Join session will open the level. This however is not working for me so was hoping for some insight on to how I would go about fixing this

#

Should this work in theory?

sinful tree
#

@gloomy sedge I believe you need to set the Result variable on the "On Success" path. As it stands, you're probably not getting anything set in the variable.

gloomy sedge
winged badger
#

Datura is right

sinful tree
#

Yeah, the other thing is by setting it in a loop, you're getting the last result of the results array.

winged badger
#

the results pin becomes valid only OnSuccess

gloomy sedge
#

So I should just se the variable as a single result?

winged badger
#

when the top exec out pin fires

#

no sessions were found yet

#

its an async node, and top exec pin is synchonous

#

so the Results pin is as a result, empty

#

only when OnSuccess fires did it find the results you can use

#

i have no idea what you're hoping to accomplish with that foreach loop though

sinful tree
#

You may want to do some checking of data with those results... They contain more data, like how many players are present in the session etc....

#

Ignore that pic..

#

This would only look at the first result back, but it's also checking if current players < max players.

gloomy sedge
#

Okay, Thank you very much you two. Great help!

#

So when calling JoinSession with the found result, Will is take the player from the MainMenu to the Server Level?

winged badger
#

that foreach loop

#

will keep setting result until you reach the last result

#

so it basically iterated the whole array to find the last element

gloomy sedge
winged badger
#

yeah, that looks saner

gloomy sedge
#

haha saner

#

So now this is looking better, should this transfer the player from the menu to the server map?

sinful tree
#

That looks better, but again, you may want some verification before trying to join the session... like...

#

This would iterate all the results, filter out all that are at max capacity or have a ping > 500, then loop through them until it successfully joins one

#

Probably getting ahead of what you're looking for... Which is just to at least connect using the join session thing, but yes, what you have should work now.

gloomy sedge
#

@sinful tree wow! Thank you very much, You are a very helpful

#

Is that 'GET' a ref or Copy version? or does it not matter at this point?

sinful tree
#

I usually use ref when possible myself.

#

Shouldn't matter specifically in this case.

gloomy sedge
#

@sinful tree You still available?

sinful tree
#

@gloomy sedge Yep

gloomy sedge
#

Are you able to answer a couple questions?

sinful tree
#

I can try. No master of all myself ๐Ÿ˜›

gloomy sedge
#

Okay, So i followed the Epic tutorial on how to create a dedicated server

#

I have the server up and running

#

On the correct level

#

I have packaged the game and run the .exe

#

I click Join and the get the print string Unable to Join any servers!

#

Meaning that the Join Session is Failing to join any of the servers found

#

However, when I use the console command 'Open 127.0.0.1' It connects

sinful tree
#

I'm not really familiar with the particular tutorial you're talking about and I haven't really messed with the default Online Subsystem...Going out on a limb, but my guess would be that attempting to join a session would be trying to connect to your own computer using your external IP address, which doesn't work too well from what I've seen. Do you have another computer you could try running the client on?

halcyon totem
#

how can I make my windows open up even when testing multiplayer?

#

right now they open one on top of the other and I have to manually set them

#

does anyone kknow

gloomy sedge
#

Unfortunate I do not have another computer to hand ๐Ÿ˜ฆ

sinful tree
#

Even production games have this kind of problem - Conan Exiles as an example, trying to join a server that appears in the server listing that's provided in-game that's running on my own network would fail, but I could join it using a manual internal IP address without issue. Do you have a link to that tutorial?

gloomy sedge
#

Actually, might just nab my dads laptop

#

They use the simple Open Level to 127.0.0.1

sinful tree
#

Ok, I'm guessing your server is calling this node somewhere in its game mode or instance?

gloomy sedge
#

Nope, I didn't think I would need to as the server is being hosted through a sepereate Server.exe

#

Oh, I have just seen that I may need to Port forward

round star
#

Ugh

#

I can't get a dedicated to server to show up in steam server list >_<

gloomy sedge
#

@sinful tree I'm heading to bed now 3am.. ๐Ÿ˜ฆ Thanks for all your help. Very much appreciated

sinful tree
#

Sorry I couldn't be more help. Sleep well.

somber glade
#

My understanding of the "reliable" option on something like a multi-cast is that it would "try" to run it, but if the server is really busy or something, it could fail. Just working on some combat effects, one of which is the small explosion particle when a player dies. The apply damage is being run on the server, so when it applies damage to a unit, if the health is less than zero it should explode, which links to a multicast which spawns an explosion particle effect. Without reliable ticked, it never ran on the client, not even once. I tried it about 20 times in pie, and nothing. I ticked reliable and of course it shows up. I feel like a pie environment should be ideal for testing something like that. Shouldn't this be playing some, if not most, of the time?

lime leaf
#

@somber glade IMO if all in stat unit is showing green it should. IDK if it does though but that'd be what I'd expect

somber glade
#

Very strange. Everytime I think I'm starting to get a handle on this, it just acts even weirder.

lime leaf
#

I've used to tick reliable on everything, and grown fond of using "WasActorRecentlyRendered" node to cull everything not needed to be shown/triggered

somber glade
#

That's probably what I'll have to do.

#

Don't suppose you know any way to get both windows in PIE to produce sound at the same time do you?

#

I want to make sure the impact sounds are playing but sound only seems to play when a window is focused.

lime leaf
#

I've been playing around with that WARR thing for controlling ticks to make my colonists walk at 5fps when outside of view f.ex. but if you do multiplayer note that it runs on client server but if you set f.ex. tick interval, it sets it for the actor both on server and client :S So I tried timers instead, but it doesn't seem to work well enough.. I could have separate timer on client and server, and change the interval based on WARR but it seems timers are less reliable than ticks in my case anyway

somber glade
#

Nice thanks. that's helpful

#

Sadly it didn't seem to work even after a restart.

#

well..it sort of works.

#

it works if the focus isn't the other pop up window

#

if I select a window and then click on my browser for example it keeps playing a sound, but if i click on the other Editor window, the sound stops

lime leaf
#

"There's an editor setting for Allow Background Audio" all I found quick heere

#

only works in Editor

somber glade
#

Yeah I've got that checked already apparently. Ah well

#

I'll just test it in a built version I guess

#

I'm guess this probably works in built games and controls volume when you tab in and out of a game.

ember needle
#

basically as soon as the client also sets physics disabled, the listening server moves the mesh to 0,0,0

#

if the client does not disable physics, no issue.

thin stratus
#

Could that be related to you not disabling the movement?

#

The CMC is not happy with Physics Simulations

ember needle
#

the weird thing is that it really seems related to movement, since the server sends the mesh to 0,0,0 when the CLIENT calls "set all bodies..." to disable physics

#

if I do not disable physics ON CLIENT, then the server is ok

meager fable
#

Imagine this scenario, My client calls server spawn actor SomeActor Inside SomeActor I create an input binding, whose input will it trace for? Owner's? Everyone? No-one?

thin stratus
#

@ember needle Honestly, have thought about just spawning a dummy actor?

#

I don't know why that bug happens to you, but at this point it sounds like you could just spawn a Dummy Actor and give it that skeletal mesh and hide the character

kindred widget
#

@meager fable Input is local. So per machine. If that actor has an input key bind, it would be able to be used by whatever PlayerController calls Enable Input on that actor.

meager fable
#

Thanks

ember needle
#

@thin stratus yes I can go this route, but then I have to replicate the pose. That said, I am able to reproduce the "bug" with the TPS UE4 project, if anyone would like to take a look.

grizzled stirrup
#

Any tips on lowering Steam sockets latency? I know it routes through Steam relay servers but one of the advertised features of the service is that it reduces ping yet it's going from an average of 10ms ping without steam sockets when testing with a friend in the same city to 100+ms ping. I wouldn't even mind if it's slightly higher ping but this is like it's routing from EU to US and back again to complete the connection. I'm not sure if I'm missing some kind of detect region functionality or something and it's automatically set to an overseas routing server

royal sigil
#

Hi guys! I'm creating a BP actor with RepNotify bool var. I change this var on server, actor itself has Replicating enabled, but OnRep_ function fires only on server world. Any ideas why?

meager fable
#

If I spawn an actor on the server, does its begin play only get called on the server?

meager spade
#

if its not replicated yes

#

if its replicated, then it will be called on server and all clients

meager fable
#

thanks

meager spade
#

@meager fable by all clients, i mean all clients it replicates too

#

like you may only have an actor that replicates to owning client

royal sigil
thin stratus
#

is the Actor replicated?

meager spade
#

show me the property details

#

he did say actor is replicated

#

btw if client changed that property locally, then its likely that wont fire the onrep. going to need more details @royal sigil

thin stratus
#

Ah, I didn't see the first message

royal sigil
#

Yes, actor replicates

meager spade
#

and how are you setting it

#

the value

ember osprey
#

does UFloatingPawnMovement replicate out of the box like UCharacterMovementComponent ?

meager spade
#

no

ember osprey
#

f

meager spade
#

if you look at the new Network Prediction plugin

#

it has a replicated floating pawn

#

using the new Network Prediction

ember osprey
#

is it stable yet?

meager spade
#

stable yes, feature complete, probably not

#

but Dave Ratti mentioned on UDN that it is stable

ember osprey
#

because I'm using the flying template and none of its pawn movement is replicated. WTF?

meager spade
#

ofc not

#

it doesn't use CMC

#

look at network prediction extra, flying pawn

ember osprey
#

Whats the easiest way to get the movement in that template replicated?

thin stratus
#

The only other thing that is somewhat replicated is the ProjectileMovement one

meager spade
#

and try it out

thin stratus
#

Replicating the Movement is the easier part :D making it smooth is the other story

ember osprey
#

@thin stratus read your doc, good stuff.

meager spade
#

yeah, network prediction is going to replace a lot of the CMC

#

probably as a different class

#

to keep compatibility

thin stratus
ember osprey
#

so should I try to convert my flying pawn to a character then?

meager spade
#

well, you can, but, CMC is kinda built more for characters

thin stratus
#

Characters can fly though, so that would help you :P

meager spade
#

that is true, though network prediction does have a replicated flying pawn, and i would rather use that ๐Ÿ˜„

#

probably a lot cheaper also

ember osprey
#

its a straight up aircraft, is there an aircraft character example somewhere?

meager spade
#

maybe somewhere on the interwebs

bitter oriole
#

There is, the flying pawn

#

It's just not multiplayer enabled

meager spade
#

honestly, go look at the network prediction extras flying pawn

#

it works, really well

ember osprey
bitter oriole
#

He probably did

ember osprey
meager spade
#

that compendium needs a revision ๐Ÿ˜„

bitter oriole
#

@ember osprey Look into rollback/replay, prediction, and do your own multiplayer stack for that mvement

#

About a month of work

meager spade
#

or do what i said

ember osprey
#

c'mon

bitter oriole
#

One of the paid Udemy courses on UE4 goes through pretty much that

meager spade
#

look at network prediction plugin

#

it has all that already

bitter oriole
#

Or that

thin stratus
thin stratus
#

Is that official Epic stuff?

ember osprey
#

udemy course

#

You're famous dude!

thin stratus
#

I know a few years ago that Jess had a presentation to introduce peeps to UE4 and the community and they mentioned me in it.
Was cool, cause I was randomly sitting in the audience. Not so cool that she pointed to me and everyone rotated.
I was just chilling ;_;

thin stratus
ember osprey
#

Yeah you can't take two steps around the multiplayer world without someone mentioned the The UE4 Network Compendium ๐Ÿ˜‚

meager spade
#

network prediction plugin flying pawn

thin stratus
#

Noice

ember osprey
meager spade
#

its example

#

in the plugin

meager spade
#

yh

#

but enable the plugins

#

then show engine content

ember osprey
meager spade
#

and you have this

thin stratus
#

Didn#t know it was that far already

#

Did they state anything on how long it takes to be more or less feature complete?

#

At least in terms of a "version 1.0.0"

meager spade
#

dave stated its a point where no more changes to the underlying code will happen

#

at a *

ember osprey
#

so boiling it down.....switch to character or use that plugin? Which is the best choice?

thin stratus
#

Which means, you can use the underlying code to do all sorts of things?

meager spade
#

yeah

thin stratus
#

And they will use the same code now to maybe fix that mess of a cmc?

winged badger
#

hah

thin stratus
#

@ember osprey If Character works for you, switch to that

meager spade
#

well that should have happened before the end of this year, but with the current world situation

winged badger
#

that will take some work to untangle

meager spade
#

probably next year mid or end ๐Ÿ˜„

thin stratus
#

Gotcha

meager spade
#

that's the info i saw on UDN anyway from Dave.

ember osprey
meager spade
#

@ember osprey i would use the network prediction

#

for flying pawn

#

it seems a better choice than CMC for flying stuff

ember osprey
meager spade
#

nope

thin stratus
#

Idk how easy it is to debug it and extend it. CMC is a mess, but atl east people fought with it in the past

meager spade
#

CMC is a royal PITA

ember osprey
meager spade
#

i still fight with it daily, that and the navigation system

thin stratus
#

But Flying should be a movement mode on the CMC

#

So it should be build in

winged badger
#

it also tightly coupled to both character and playercontroller

#

and has code tendrils in both those classes

#

which is awful

meager spade
#

yeah, not encapsulated in the slightest

#

you can't use CMC without using ACharacter

winged badger
#

and you need to override half of it if you want the autonomous proxy to be controlled by AIController

#

that was just... yuck

ember osprey
# meager spade yeah, not encapsulated in the slightest

So with this plugin am I still gonna have to replicate everything in the pawn and then just have prediction with the plugin, or will that plugin basicallly make the replication handling as out of the box as using the CharacterMovementComponent?

meager spade
#

it will replicate the movement

#

no need for CMC

#

look at NetworkPredictionExtrasFlyingPawn.cpp

#

you will need to create your own version of that (as that has hardcoded input bindings, etc0

#

but its based on APawn

#

and is really easy, and its commented quite well

ember osprey
#

ok, thanks for the help!

ember osprey
empty axle
#

In the bottom right you need to check "Show plugin content"

thin stratus
empty axle
#

Yeah or engine content actually

pallid mesa
#

oh nice, gotta use the heck out of it

gloomy sedge
#

If I have a dedicated server running on my PC following the guide on the UE docs site. Do I still need to 'Create Session'?

pallid mesa
#

kaos!! you should have told me before hahaha

gloomy sedge
#

I would presume no, But I keep getting 'Unable to join server'

pallid mesa
#

can I have the link to the guide you are following?

gloomy sedge
#

The guide only uses the Open Level node to localIP

pallid mesa
#

Ah I see, the setup for the guide is a much simpler tutorial since it's joining the local server instance you created through open level

#

so it's a bit like cheating

#

if you do want this to work over the internet with an OSS you do need to take a look into sessions

dark edge
#

I can't find much on the upcoming Network Prediction plugin, anyone here got an elevator pitch for what it does?

pallid mesa
#

if you are a Blueprint consumer, I do recommend you using the AdvancedSessionsPlugin from mordentral, it's really narrow, and if you have any question, probably someone has already had it before in this forum thread https://forums.unrealengine.com/community/community-content-tools-and-tutorials/41043-advanced-sessions-plugin @gloomy sedge

ember osprey
pallid mesa
ember osprey
#

From the official Epic github

#

the plugin is supposed to replace UCharacterMovementComponent

dark edge
#

Does it look like it's movement specific or a more general property prediction system?

ember osprey
#

dave ratti

ember osprey
meager fable
#

are delays broken in multiplayer? My Replicated actors begin play gets called untill debug on the client and then stops, runs perfectly fine on the server

pallid mesa
orchid pollen
#

This doesn't seem to be replicated/working on remote clients, is there another way to determine otherwise if a character is on the floor or not?

meager spade
#

movement mode will be falling

#

otherwise will be walking

orchid pollen
#

yeah this seems to be the same result, the server and owning client only seem to know about this, remote clients dont appear to be aware of the current mode

meager fable
#

Server prints that magma burst is valid and client prints that it's invalid how come this happens?

meager spade
#

because your spawning a replicated actor

#

then running a multicast

#

RPC's can arrive before the replicated actor arrives

#

so welcome to networking and race conditions

meager fable
#

oh boy

orchid pollen
#

why don't you just spawn it on each client individually on the multicast?

meager spade
#

or let beginplay of the replicated actor handle it?

#

as that will be called on clients its replicated too

meager fable
#

yeah that's a good idea

#

thanks guys

halcyon totem
#

happy friday everyone, when working on a mutliplayer map with streaming levels are we suppose to keep the lights on their own level? when streaming out of levels lights bleed sometimes

gusty slate
#

Hello everyone, is there a way to use the SpectatorMode and states and still be able to allow the player to attach/follow other Pawns?
a simple AttachActorToActor isn't working

tidal crown
#

(think updating list of players in a lobby UI)

#

Seem odd that the engine doesn't provide OnRep_Notify for this

#

but I guess I can make a parallel synchronized array? Just seemed wasteful to me.

dark edge
#

@gusty slate what pawn do they have in spectator mode?

gusty slate
#

A pawn deriving from spectatorpawn

#

With an CMC

#

@tidal crown There is a function in GameMode called when a player connects and is assigned a controller, I think it's OnPostLogin

dark edge
#

@gusty slate the CMC is probably overriding movement, are they meant to ever move around on their own or just follow players?

gusty slate
#

I tried disabling the CMC before doing an attachment but it didn't work. Ideally I would offer both player follow and free roam, but Player follow is more important

tidal crown
#

GameMode events aren't replicated to the client.

gusty slate
#

you can start your implementation from there

short cliff
#

Hi everyone;
Quick question; I have some cubes on my level. I want to set a cube selected on the dedicated server when I clicked on it. I tried to make an rpc call with the cube actor as a parameter but it came null on server. How can I achieve something like this? The cubes are replicated of course, and I'm calling a function marked as Server.
Thanks.

kindred widget
#

@short cliff What actor are you calling the ServerRPC in?

#

One major thing, make certain that you're ONLY spawning the actors on the server, or that they're loaded from the level and set to replicated. So that the client itself isn't spawning it without it being told to from the server. If that's the case, you should be able to pass it's pointer to the server. Should come up valid.

round star
#

Can someone help me out with getting a dedicated to server to show in the stem server list. I can't get it to work..server runs just fine..but wont show in list at all

crystal umbra
#

Wow delays are really bad to use Timelines/timers are always the way to go. Or so it seems

fervent spoke
#

does replication of actors (or movement components) extrapolate/predict positions or something? like say a client has 100ms lag and an actor begins to move. does the client see the actor 100ms behind where the server sees it or not? because i would expect it to yet i'm seeing results inconsistent with that expectation
sometimes the clientside actor is ahead of the serverside one
edit: haven't tested on a real network, just with net pktlag

wise bridge
#

Hello everyone, I have been stuck on a stupid thing for a long time, I try to set in place a leave game button, work perfectly well when the client leave, but when the host do I can't make client leave from a PClist done at their connection. Any ideas why?

fervent spoke
#

btw does net pktlag add a delay from server to client? or only client to server

#

i think that would explain the problem i just mentioned as well as another issue i ran into

glad sedge
#

dedicated multi builders - what source do you pull from to do a build for 4.26? release? master?

sinful tree
#

@wise bridge When doing "Get Game Instance" you're getting it only from the computer that is running the game. So when a client leaves, it'll work just fine, but when the host leaves, your loop goes through the list of PCs, but it's looking at the hosts' Game Instance.

#

What you need to do is have an event on the player controller that is called instead, and that event can then get the game instance and run your destroy session caller

wise bridge
winged badger
#

@wise bridge unreal knows how to go to the default level when the host disconnects

#

so you can just wire destroy session on your main menu level beginplay

#

and do nothing else on clients

dark edge
wise bridge
#

Ty

vocal cargo
#

hey, weird issue here. I can't set the visibility of a component even using a Multicast

#

it works on the local client but it's not replicated to other clients

tidal crown
#

why the fuck is the only way to do seamless travel in BP to use "execute command"?

#

that is...hacky as shit

sly violet
#

I need answers on this as well. My head is gutted

winged badger
#

if you think c++ does something drastically different

#

you'd be wrong

tidal crown
#

it feels very gross to do that

sly violet
#

@winged badger Oh no...

tidal crown
#

like fuck it we're gonna use a text-based API ??

winged badger
#

yeah you can call ServerTravel

#

but comes to the same thing

tidal crown
#

call ServerTravel from where

#

in BP?

winged badger
#

c++

sly violet
#

Ok, follow up question. Should that server command live in Game instance, for any good reason?

tidal crown
#

oh

winged badger
#

would take entire minute to make a BPCallable wrapper

tidal crown
#

Yeah, I guess tho like there's C++ modules behind "servertravel" right? Why is this the only public API

supple mural
#

How do you guys fix rubberbanding?

#

I'm desyncing on my own local server, it's embarrassing!

tidal crown
#

what are you doing exactly?

#

That seems pretty hard to do.

#

are you doing a lot of stuff w/ server ticks? BPs?

supple mural
#

I'm just trying to walk, jump around in my map

#

Yeah my game is built entirely in blueprints

tidal crown
#

do you have a lot of timers/tick-based things happening?

#

that can cost you performance, especially in BP

supple mural
#

I have event timer delegates and stuff

tidal crown
#

a lot? are they really high frequency?

supple mural
#

I don't think I have many though

tidal crown
#

have you done any network profiling w/ the tool provided?

supple mural
#

The ones that fire, don't fire often and fire only on input and when it's done

#

I didn't know that existed

tidal crown
#

oh yeah check out the builtin network profiler

#

you can get a file that records network events and see if theres something weird

supple mural
#

Alrighty I'll look into it! Thanks a lot

#

Just curious, you think it'll be the same if I'll redo everything (everything reasonable anyways) in C++?

tidal crown
#

could be

#

BP is I've been told 8x slower than C++ but I bet its not likely the case for u

#

i have a BP based game and its not desyncing

#

i bet its something simpler

#

network profiling will tell you more for sure

signal lance
real sky
#

I had a question about Multiplayer when it comes to blueprints, is it possible to create a fully functional multiplayer game with just purely blueprints?(Including plugins)

meager spade
#

sure though you will hit limitations

#

do i recommend it? no ๐Ÿ™‚

winged badger
#

i would not count on it being smooth with more then 4-8 or so players and very limited world size

real sky
#

How limited do you think the world will have to be?

winged badger
#

you literally have only 10% network functionality in BP

real sky
#

Gotcha

meager spade
#

plugins on the marketplace can kinda get past that though

winged badger
#

100-150 replicated Actors tops

real sky
#

Damn

winged badger
#

with 8 players

real sky
#

Would AdvancedSessions and other plugins people usually recommend solve some of the problems?

winged badger
#

they have nothing to do with in game networking

real sky
#

I see

winged badger
#

i honestly believe its less painful to learn c++ then network a game in BP

real sky
#

Time to throw a year of my life away lmao

winged badger
#

how long it takes depends on your existing skills

#

if you're already familiar with unreal API

#

it will be easier, as you don't need to learn API and c++ at the same time

#

if you have unreal-unrelated programming experience

#

that helps tons

real sky
#

Iโ€™ve been using BP for about almost two years and gotten the hang of things, will that help??

winged badger
#

yes, even more so if you learned good practices along the way, and don't do spagetti

#

c++ function names are same or similar as BP function names, generally

real sky
#

hmmm so transferring over wouldnโ€™t be that hard

winged badger
#

and you know at least a part of what engine offers

#

if you're serious about making games, i would definitely recommend it

real sky
#

I see

#

Thank you for the advice

#

and honesty

winged badger
#

c++ can do so so much more then BP, and unreal is designed to work with combination of c++ and BP really

real sky
#

I see many videos from epic using BP for their multiplayer examples and it seems like it runs perfect without any C++

winged badger
#

we can spawn a 30k Actor procedural level and have it networked and ready to play for 8 players in a few seconds

real sky
#

Oh damn

#

thatโ€™s fast

#

wait procedural!?

winged badger
#

most of techniques we use are not available in blueprints

real sky
#

Def gonna think about swapping over

winged badger
#

we have 1200 interactable actors replicating using only 16 actor channels

#

which allows our server to cope with the sheer number of them

#

a lot of stuff, even basic stuff is just not exposed to blueprints

#

for example, you want to know when your Pawn is possessed on client, in BP

#

in c++ you can use OnRep_Controller

#

in BP you have to gimmick a Client RPC for it

#

which just uses extra network resources

#

and OnRep_Controller is part of the engine, so it will happen anyways

real sky
#

What if you created a small LAN project?? Would BP be able to run it just fine??

#

or Iโ€™m guessing C++ is the way to go for that

winged badger
#

small sure, but when im talking about creating a game, i am talking commercial

real sky
#

Ahhh i see

#

cause thatโ€™s what I want to create first

#

just something me and my friends could play

#

Obviously if iโ€™m doing a commercial product I would need to learn the industry standard

twin juniper
#

Hey I'm working on continuous fire abilities for my combat system and I am thinking of ways to deal with packet loss. Should I use reliable RPC for the cancel action or is it better to have unreliable RPCs sending on an interval in terms of network usage?

winged badger
#

you'll still probably benefit from c++ just because of sheer amount of extra tools you get

#

@twin juniper how to handle something like that depends on so many things

twin juniper
#

I was hoping you wouldn't say that ๐Ÿ˜›

winged badger
#

my simulated proxies, for example, just know the character is firing

meager spade
#

what is a continuous fire ability?

winged badger
#

and have a fairly accurate idea whats it firing at

meager spade
#

weapon shooting?

winged badger
#

nothing else

twin juniper
#

yes like automatic weapon or channeled spell

winged badger
#

then they just guess on their own

meager spade
#

they are both different things

twin juniper
#

In my system I handle them both in a similar way

winged badger
#

you should definitely simulate, rather then replicate, everything you can get away with

twin juniper
#

I'm planning to have them execute a routine on a timer until a cancel action is received

meager spade
#

i RPC every bullet ๐Ÿ˜„

#

in my pet project

twin juniper
#

you do?!

#

that is important for accuracy I presume

meager spade
#

except minigun

winged badger
#

that brings the question what is accurate enough

#

game Kaos and i are working on for a living

#

is an 8 player co-op shooter with isometric camera

#

it doesn't generally matter if one shot ends up missing on client while it hits on server

modern swift
#

hi anyone know what cause pawn not spawn on remote client?

winged badger
#

as there are so many bullets flying around, you really can't tell

hidden frost
twin juniper
#

My concern is that players will find that they have lost resources because actions kept executing due to a lost packet

winged badger
#

what type of game is it?

twin juniper
#

but perhaps I can do something similar to @meager spade and rpc a batch, and then if the next RPC is not received for the batch, it cancels the timer and does not execute

#

third person action/shooter

winged badger
#

Kaos uses GAS there

twin juniper
#

somewhat of a premium on accuracy but not CS GO important

meager spade
#

ya

winged badger
#

so he has built in prediction

#

he has hooks to roll stuff back if something goes to shit

twin juniper
#

I've made my own predictive system so I can handle that myself

#

I don't have experience in running a multiplayer game though so I am unsure what is the best mechanism over the network regarding unreliable and reliable RPCs

#

I would prefer a single RPC to cancel a continuous ability as the alternative may tick one or two extra times after the client chose to cancel

meager spade
#

GAS handles that nicely

winged badger
#

single RPC is fine, and that one should be reliable

#

also, timestamped

#

you don't want the variance in network latency causing it to cycle an extra time on one end

twin juniper
#

it will probably be one of the few reliable RPCs I use tbh

#

probably not the end of the world for bandwidth

#

@meager spade I did think about using GAS but decided against it in the end. A few things about it bothered me so I just rolled my own. It isn't as efficient no doubt but it works pretty nicely.

winged badger
#

bandwidth

#

is usually the least of one's problems

#

both the RPC buffer if you overdo it

#

and server's time evaluating actors for replication

#

are much harder to manage then bandwidth

twin juniper
#

the RPC buffer on the server for receiving RPCs from clients?

winged badger
#

for sending, receiving is easy

twin juniper
#

ah

#

So number of actors living on the server is the most important concern?

#

Hmm, I've just realised I don't really RPC from the server

#

So I suppose that isn't an issue for me so much as the number of replicating actors on the server

winged badger
#

few hundred is ok

#

more then that and you'll need to start to optimize

twin juniper
#

That is a plentiful budget for my game, I think I'll be okay

meager spade
#

fortnite has 50K replicated actors

#

on dedicated server ofc

#

Listen Server is a whole other ballgame

#

(as server and client logic has to be running the same time)

twin juniper
#

I'll be using dedicated servers if I can

meager spade
#

i wouldn't go dedicated on first game

twin juniper
#

that 50K is optimised a lot though, isn't it?

meager spade
#

the cost is immense

#

unless you have deep pockets/backers

#

or only expect 10 people to play ๐Ÿ˜„

twin juniper
#

it's a concern, but does the design change a lot if you wanted to design for listen server after having expected to design for a dedicated set-up?

meager spade
#

yeah

twin juniper
#

in what ways?

meager spade
#

well you normally gate stuff of with HasAuthority etc

#

or !HasAuthority

#

but then you need to check for things like IsLocallyControlled whilst being authority

#

for listen server

twin juniper
#

Hmm, couldn't you just run a server and a client on the same machine?

meager spade
#

that is not listen server

#

but sure

#

seperate dedicated server instance + client instance is fine

ancient moth
#

Hello ! I would need someone used to compiling dedicated server and client. It compile again the engine every times, even without any change on it... Need some help to understand why and fix it.

twin juniper
#

I think that is how I would do it since it would mean I can be lazy

#

people have beasty PCs these days anyway

winged badger
#

@ancient moth build a project, not a solution

meager spade
ancient moth
#

I did it, it build the engine anyway.

meager spade
#

mine never rebuilds entire engine

ancient moth
#

I know... 3 months I try to understand why it do on mine :/

#

I saw thousand of forums where people have this problem, but no solution...

meager spade
#

you deleting things?

#

like intermediates folder?

#

you accidently changing engine code without knowing?

#

just a single space could trigger a big rebuild

rich ridge
meager spade
#

depends what file

#

though ๐Ÿ˜„

#

a core file, could cause a lot to compile

rich ridge
#

Yes because most of the modules do use core module

#

So it's a big chain

halcyon totem
#

I think I need a multiplayer expert I need to know why is unreal giving me errors for a line by trace for this reference ? I have a mesh on a character I use to interact with an elevator button it works but when in client mode it gives errors

#

how else am I suppose to get a reference??

ancient moth
#

@meager spade I didn't delete any file and if I modified an engine code, I don't remember it... There is a way to reset all engine code to be sure it don't ?

halcyon totem
#

how is it possible im getting an access none from my player controller for a button press? is there some other way I need to access my player controller to use the is input keydown?

ancient moth
#

Also, when I do modification on the editor (blueprint) and try to build the dedicated server, it tell me the target is up-to-date and don't build anything...

#

It's like if it can't check if a file is modified

#

Maybe for this it rebuild the engine each time ?

gloomy sedge
#

@halcyon totem I would suggest you cast to your playerController class as well

kindred widget
#

Should always cast to pointers before using them. I'll end up saving you both computing and debugging time.

#

Well, check if they're valid more than cast. But in blueprint most people use that as validity checks.

gloomy sedge
#

The character's Movement Comp is Replicated

kindred widget
#

@gloomy sedge You don't have to replicate the CMC. It does all of it's replication through the ACharacter class. Rubberbanding is usually due to lag between the server/client and the client predicting it's movement too far and the server correcting it, or the client and server having different movement speeds.

#

Yeah, your client also needs to set Movement Speed.

#

Oh, does. Missed that. Hmm.

#

I admit, I do this by just replicating a single bool of something like "SpringButtonDown" and have that RepNotify and let it change the speed on both.

gloomy sedge
#

I also check the Stats Net CVar and ping was around 15

#

Okay, I shall try the RepNotify and see if any changes

#

Using your way of replicating the single Bool still creates the rubber banding

kindred widget
#

@gloomy sedge What are your movement speeds? Are they something crazy?

gloomy sedge
#

150 walking, 300 sprinting

kindred widget
#

Hmm. Not likely that then. It only happens with the sprinting stuff?

gloomy sedge
#

it does also happen with the standard walking

kindred widget
#

Someone experienced in the difference between ListenServer and Dedicated is going to need to help then. :/ Cause simply setting the speeds to about the same, and making sure that the client isn't passing the distance setting thing with too fast of speeds is all that's really needed on a Listenserver. I can't see why that should change on a Dedicated server. ๐Ÿคทโ€โ™‚๏ธ

gloomy sedge
#

yeah very confusing, unsure whether it is just my internet speeds everything being hosted on it or what. but can't even find anything online about rubber banding on dedicated servers

limber gyro
#

guys i have an actor that spawn and then does a raycast and dies, i use this for hitscan bullets

#

i also have a regular projectile actor

#

the both replicate

#

and when they apply damage the player is suposed to simulate phisics so that i can do physical hits

#

the issue is, while both actors are replicated the hitscan one doesnt work

#

since it is replicated i was under the impression that it should spawn in the client and do the raycast there aswell

#

maybe i am wrong?

kindred widget
#

@limber gyro You're likely killing it too fast. If you spawn something on server, and then set it for destruction before it even replicates, it won't get replicated to clients.

#

You'd be better off just doing the trace in the weapon and letting that persistent actor replicate whatever it needs to it's client version.

limber gyro
#

i have a destroy timer os 0.2f

#

of''

#

i will try making it bigger

kindred widget
#

Not sure then. Should work in theory if there's less than .2 seconds of lag.

#

But it's still a pretty brutal way to do that. Spawning is semi costly for something as simple as a line trace.

limber gyro
#

maybe i shouldve gone with a regular bullet with 999999 speed with CCD

#

ye doesnt work even with the bigger timer

kindred widget
#

The spawned actor is replicated and only spawned on the Server?

limber gyro
#

yes

kindred widget
#

That's odd. While maybe not a good idea, it should still be working.

#

Are you doing a lot of networking? If so, have you upped the 10,000 bit per second limit?

limber gyro
#

i dont think so

#

i havent even heard of that before

#

also ive had people from india play in us server while having less than 50ping so i am assuming my network is pretty light

#

the default scene root does not replicate tho

#

let me check that

#

still the same

echo snow
#

Is ping even related to that

kindred widget
#

Not really no. It's an engine hardcoded limit that the engine itself will enforce.

#

@limber gyro Add this to your project's DefaultEngine.ini

#
ConfiguredInternetSpeed=1000000
ConfiguredLanSpeed=1000000

[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=1000000
MaxInternetClientRate=1000000```
limber gyro
#

what does that do

kindred widget
#

That setting is a Megabit, you can lower it if you like.

limber gyro
#

but how is that relevant to the issue?

kindred widget
#

The default is 10,000. Basically it will not allow any data to be sent via replication or RPC if you have reached 10,000 in that second. So if you send 30,000 bits instantly for immediate replication, you're waiting for three seconds before ANYTHING else gets through, like actor replication.

#

It might not be, but you're having trouble having an actor replicate. It's a step to try.

limber gyro
#

i am 100% sure that is not the issue my friend, if that were the issue the regular projectiles woulndt be working too

kindred widget
#

Likely not, no.

limber gyro
#

im going to check it if it is indeed replicating by giving it a cube or something to see if it shows up

#

yep the cube shows up

#

could it be that the raycast is being made in the server and not in the client

#

??

#

maybe the server thinks that since it was already done in the server it doesnt need to be done again

kindred widget
#

Really depends on how you've set up the spawned actor?

limber gyro
#

wait i think ive found the issue

#

not sure tho

kindred widget
#

What event is the cast done on? How does it know to do it on the Client?

limber gyro
#

i am using a hasauthority

#

its spawns a raycast on the tick

#

because the begin play was too fast for stuff to work

twin juniper
#

Hi, I would appreciate any help. I need help understanding multiplayer pawn possession. At the moment I calculate one transform for each player controller in my game mode on 'event onpostlogin', then I cast to the each player controller and inside each player controller I do the following

#

but doesnt seem to work.

limber gyro
#

@twin juniper i think u have to specify the controller

#

let me check my code

twin juniper
#

This script is inside my player controller so 'self' is a player controller.... or do these PCs not exist on server or something?

kindred widget
#

@limber gyro But if you're using HasAuthority, won't that only run it on one or the other?

limber gyro
#

doing it on the else part

#

@twin juniper i think in theory u are correct, in practice i have followed a tut from an apic guy and he passed the controller

#

so i dunno

kindred widget
#

@twin juniper Normally GameMode handles Pawn Spawning, but that should work in theory. Is it not possessing?

limber gyro
#

i am doing it in the game mode aswell

#

if the PC spawns a character he will the owner no? so when u try to posses that wont there be any issue with you possesing something that the server doesnt won?

#

tbh i dont know

kindred widget
#

I'm pretty sure that the possession call also sets owner though.

twin juniper
#

I now set the script all to run in my game mode

kindred widget
#

Regardless, what is the issue? Is it not possessing, or is there just no input?

twin juniper
#

Here is what I use, I set number of players to 6 and 'hello' prints 6 times on server

#

The pawn is only spawned on server, none of the clients have pawns the controller controls

#

oh wait - I can see the other client pawns on server so I guess they are not replicated to client

limber gyro
#

LOL

twin juniper
#

so I need to replicate spawn actor somehow

limber gyro
#

go into the BP and make sure they are replicated

#

tick the replicates box

kindred widget
#

Pawn class should be replicated by default.

twin juniper
#

it is

limber gyro
#

ummmmm

#

so you can see the pawn spawning in the server, but it doesnt show up in the clients

#

?

#

and its replicated

twin juniper
#

maybe I need to multicast the spawn, but execute the possession just on server

#

Yeah dont see any pawns on client.

limber gyro
#

if you spawn something on the server and its replicated every one should be able to see it

#

try the same function in the game mode

#

see what happens

kindred widget
#

Spawn is replicated by default if the actor class is replicated.

twin juniper
#

I am spawning inside my game mode

kindred widget
#

How much other networking stuff are you doing at the moment?

limber gyro
#

i have no idea then

kindred widget
#

Cause you might have the same thing I just described to Sonic even though that wasn't his issue.

twin juniper
#

I need to replicate the pawn movement, I had rotation working but movement was a problem, I thought a problem was the fact the pawns were not being possessed properly, so I removed default pawn class and started to spawn and possess the pawns manually (also will need that for later anyway, since I want variable pawn types depending on what the player picks)

#

Also my animations replicated fine

kindred widget
#

Animations don't replicate. You use replicated conditions to simulate similar states on clients.

twin juniper
#

Ah well maybe I misremembered, but I'll cross that bridge when I get to it

#

Game mode only exists on server right?

kindred widget
#

Correct.

#

That won't have any bearing on the spawning though. You can spawn replicated actors from any class anywhere on the server and they'll replicate to clients.

twin juniper
#

Here are the replication settings. The character I am spawning is a subclass of a more general character class (with the exact same replication settings)

#

and am I right that I have 'auto possess player' disabled in each character? since I am doing the possession manually.

limber gyro
#

@kindred widget i figured it out, turns out i was hitting myself in the client with the raycast

#

hehehe forgot to add an ignore actor

#

i have no idea how this didnt create any bigger issues before LOL

kindred widget
#

Oof. Done that one before.

#

@twin juniper It's extremely odd that you can see those on the server, but not on clients with them being replicated...

#

Like, you can consistently see them on the server, all the time, no issues there?

twin juniper
#

yes, whether or not I use dedicated server

kindred widget
#

Is it possible that you're doing a ton of other networking anywhere else? What else in the game is networked?

twin juniper
#

oh I think I could be spawning wrong

winged badger
#

take a breath, rapidly making guesses as to what went wrong is rarely the most effective approach

#

putting a breakpoint on event BeginPlay is a good start

twin juniper
#

I think Im using a foreachloop where I should be using foreachloop with break

winged badger
#

you should have 1 hit on server 1 hit on all clients for every replicated player pawn

twin juniper
#

yeah fixed

#

Now I have the problem I had yesterday, I am using 'addworldoffset' to move which I have managed to replicate but it is choppy. I would like to use 'addmovementinput' or 'addinputvector' but these do nothing

winged badger
#

those work out of the box unless you did something weird

kindred widget
#

@twin juniper AddMovementInput requires a MovementComponent. Such as FloatingPawnMovement.

twin juniper
#

Oh I know I have a movement component I have tried 100 ways, I also tried adding a vector to floating pawn movement

#

my pawn is of character class which has movement component by default no?

ember needle
#

I have a level which contains many stream levels, each one with their own PlayerStarts. I need to randomize their count & position, so that everytime it's a different map (though composed of instances of the stream levels).

What is my best option to do that? ATM I'm considering having the server randomize the stream level count & position and broadcasting a replicated variable from GameState. OnRep of this variable, an event is called that triggers a "create instance" loop for these stream levels on every client. However, I'm not clear on how then to spawn the players since the creation / location of PlayerStarts happen only after all of this has happened, and in general it happens in the GameMode.

So AFAIK I have the GameState run before the stream levels are loaded on the clients.

What would be a good way to achieve this?

winged badger
#

c++?

ember needle
#

@winged badger me?

winged badger
#

yes

ember needle
#

I'm in BP but can do C++ if needed. I'm trying to understand a proper course of actions

kindred widget
#

@twin juniper Characters do have the CharacterMovementComponent by default. And you just have to call AddMovementInput from the client.

winged badger
#

is seamless travel involved?

ember needle
#

yes

winged badger
#

so there are few key points here

ember needle
#

standard lobby etc as per @thin stratus lobby on the marketplace

winged badger
#

each PC when its player loads a level (note: this will be departing lobby PC, not game PC if its not the same class)

#

first calls NotifyWorldLoaded, then ServerNotifyWorldLoaded

#

when server finishes the seamless travel, it calls PostSeamlessTravel

ember needle
#

(not the same class PC lobby vs PC game FYI)

twin juniper
#

This is the BP I have in my character. (I recently added the switch has authority didn't make a difference). The disconnected node is what I had before which worked but replicates badly.

winged badger
#

in it, it iterates over all controllers that reported in, and calls HandleSeamlessTravelPlayer for each

#

this will be before any of your streaming levels are loaded

#

and that is very much not desirable for your setup

#

as that will start the players up with what player starts it has on persistent level

#

players that finish seamless travel after server have the HandleSeamlessTravelPlayer called on them as they call ServerNotifyWorldLoaded

#

what you need to do is prevent HandleSeamlessTravelPlayer to be called at all, for any player, before your streaming levels are setup

#

and run the iterating over all controllers thing that AGameMode::PostSeamlessTravel does after they are all ready

#

ontop of that you should not let GameMode start a match before all streaming levels are up and running and all players have finished travelling

ember needle
#

ouch

kindred widget
#

@twin juniper Don't use SwitchHasAuthority.

winged badger
#

you can hook up into AGameMode::StartPlay or AGameMode::InitGameState

#

preferably 2nd one

kindred widget
#

That'll only run if you're using a Listenserver and the Listenserver is using that Pawn

winged badger
#

to start your level loading

twin juniper
#

sure but makes no difference.

kindred widget
#

@twin juniper This is your character class?

winged badger
#

you have one convenient guarantee in all of this @ember needle - no Actor on the client will ever call BeginPlay before the GameState Actor has replicated

twin juniper
#

its in my more general character class of which the specific character I control is a subclass of

ember needle
#

I had no idea that GS MUST be loaded before any beginplay is called

winged badger
#

and yes you should definitely use your GameState to do any replication you need done before BeginPlay repated to level generation

#

its OnRep_MatchState

#

in GS

#

that tells client world to call BeginPlay on its Actors

ember needle
#

@winged badger i'm not sure I got all of that, but this is gold.

winged badger
#

you have very few guarantees with order of things in networking

#

so that one is awesome

#

ideally you'd get that running, then not start the match until all clients report via RPCs they finished loading streaming levels

ember needle
#

@winged badger i'm trying to understand all of this, bear with me

winged badger
#

thats an upgrade though

kindred widget
#

@twin juniper This is all you need for a character to move from input. Should work for walking or flying movements in the CMC.

winged badger
#

^

ember needle
#

@winged badger so:

  • override PostSeamlessTravel so that it does not call HandleSeamlessTravelPlayer (hopefully there's a BP equivalent)
  • Use GS from server to broadcast the list of stream levels and their position
  • Clients create streaming levels based on this info, when they receive it (GS is replicated when BeginPlay of level BP is called)

what I'm not sure I got: "run the iterating over all controllers thing that AGameMode::PostSeamlessTravel does after they are all ready"

winged badger
#

look at the function in gamemode

#

you can just put a boolean in GM when all streaming levels load

#

and override HandleSeamlessTravelPlayer so it does if (!bFinishedLoadingStreamingLevels) { return; }

#

instead of overriding PostSeamlessTravel

winged badger
#

yes

#

but you have to execute that after your streaming levels are loaded

ember needle
#

so i can use PC to report back when levels are loaded in all players

winged badger
#

you get unintended bonus there

#

if you send an RPC each time client loads a streaming level instead of when it loads all of them

#

you get the data for the loading progress bars

ember needle
#

lol

#

IF i get this running then I'll get to that

#

...any idea if part of this can be achieved in BP?

winged badger
#

then you just transfer that data to their PlayerStates

#

and then it replicates, so each player can see everyones loading status

ember needle
#

gotcha

#

that part is easy

winged badger
#

gamemode stuff best do in c++

ember needle
#

the rest i'm still pretty much... digesting

winged badger
#

you can't really split PostSeamlessTravel in 2 functions in BP

ember needle
#

my C++ is extremely basic, i program in other languages (erlang mainly)

winged badger
#

what you need to do in c++ is fortunately pretty basic

ember needle
#

so let me rephrase

winged badger
#
void AGameMode::PostSeamlessTravel()
{
    if (GameSession)
    {
        GameSession->PostSeamlessTravel();
    }
}
#

and you need the rest of that code from it in a separate function you would call when all streaming levels load

#

and also return from HandleSeamlessTravelPlayer if the streaming levels haven't loaded yet

limber gyro
#

i have physical animation that happen when something overalps or hits the player but i only want the enemy players to see it, i dont want the player itself to run those animations, whats the correct "if" to use in this scenario?

winged badger
#

you can override ReadyToStartMatch in GameMode from BP

ember needle
#

instead of what

#

PostSeamlessTravel?

winged badger
#

?

ember needle
winged badger
#

so it doesn't start play (call BeginPlay on actors) before everything is ready

#

you want NumTravellingPlayers == 0 and bFinishedLoadingStreamingLevels == true

ember needle
#

well I need the beginplay called on the level BP

#

no?

winged badger
#

you don't

#

start everything from AGameMode::InitGameState

#

right after Super call

#

its always before BeginPlay

ember needle
#

i'm a little lost, let me see if I can write down everything and if you can confirm

winged badger
#

you can just shoot yourself a BlueprintImplementableEvent from InitGameState

#

and start the streaming level loads from BP

ember needle
#

@winged badger first of all THANK YOU. please give me a couple of minutes and I'll get back to you

#

to double check, before I loose 2 weeks on this ๐Ÿ™‚

winged badger
#

people keep telling me i should write a blog about that stuff

ember needle
#

YES

#

๐Ÿ˜„

#

@winged badger

  • override
void AMyGAMEGameMode::PostSeamlessTravel()
{
    if (GameSession)
    {
        GameSession->PostSeamlessTravel();
    }
}
  • separate all the rest in another PostStreamLevelsLoaded or something function:
void AMyGAMEGameMode::PostStreamLevelsLoaded()
{
    // We have to make a copy of the controller list, since the code after this will destroy
    // and create new controllers in the world's list
    TArray<AController*> OldControllerList;
    
    [...]
}
  • Have the server send a RepNotify variable with the stream level data, which calls an event on the Main Level BP to load streaming levels.
  • Each client notifies the server that the stream levels have been loaded via PS.
  • When server has all clients reported for duty, call the PostStreamLevelsLoaded
#

@winged badger this correct? Also, will this work for players that join in later on?

winged badger
#

might get a little choppy for late joiners

#

but it won't break them

#

don't forget starting the streaming level load from InitGameState override

#

(you can immediately set the variables on GS for clients to receive then)

limber gyro
#

does any 1 know the line of code to check if a pawn is localy owned or not?

twin juniper
#

ANy idea why this would return 'hello' (sorry for repeated repost kept noticing errors with presentation)

ember needle
winged badger
#

and overriding ReadyToStart match to halt BeginPlay

#

thats the idea

#

but server has to use something else

#

ah, fucking BP OnReps fire on server as well

ember needle
#

yep

winged badger
#

yuck

#

you can, but you still need pre-beginplay post-intializing gamestate hook

#

to set that data

#

so override InitGameState, call Super, and fire a custom BlueprintImplementableEvent

#

to start the rest form GM blueprint

ember needle
#

so then I need to call ReadyToStart after all players have reported their levels to be loaded?

winged badger
#

no, GM calls that every tick

ember needle
#

but if I override it?

winged badger
#

you just need to make sure that it returns false

#

until its ready

ember needle
#

ah ok

winged badger
#

as for streaming levels themselves, not an expert there, haven't used them much

#

we brute force generate and spawn the entire level

#

using similar methods

ember needle
#

@winged badger ok so the end of that would be:

  • Have the server send a RepNotify variable with the stream level data
  • Override AGameMode::InitGameState, call Super, and fire a custom BlueprintImplementableEvent to start the rest form GM blueprint
  • Each client notifies the server that the stream levels have been loaded via PS.
  • When server has all clients reported for duty, call the PostStreamLevelsLoaded
  • Override ReadyToStart match to halt BeginPlay if not all players have reported their PS.
winged badger
#

out PlayerStarts are not random though, so we don't have to delay HandleSeamlessTravelPlayer like you do

ember needle
#

ah so all of this is for the playerstarts?

#

yeah indeed

winged badger
#

they won't be in the pool unless the levels are loaded before the starts are selected

#

oh and also

ember needle
#

but why do I have to Override AGameMode::InitGameState instead of using the OnRep of the stream level data?

winged badger
#
{
    return (Player != nullptr && Player->StartSpot != nullptr);
}```
#

this abomination

#

just override it and return false

#

but you have to set the StreamLevelData from somewhere ๐Ÿ™‚

#

in order for it to have OnRep called

#

that is what you do from InitGameState override

ember needle
#

AHHH ok so I set it in there

#

gotcha, lost that

#

@winged badger SO, the summary:

  • override
void AMyGAMEGameMode::PostSeamlessTravel()
{
    if (GameSession)
    {
        GameSession->PostSeamlessTravel();
    }
}
  • separate all the rest in another PostStreamLevelsLoaded or something function:
void AMyGAMEGameMode::PostStreamLevelsLoaded()
{
    // We have to make a copy of the controller list, since the code after this will destroy
    // and create new controllers in the world's list
    TArray<AController*> OldControllerList;
    
    [...]
}
  • Override AGameMode::InitGameState, call Super, and fire a custom BlueprintImplementableEvent to populate the stream data that gets replicated to clients from the GameState
  • Each client notifies the server that the stream levels have been loaded via PC.
  • When server has loaded its own stream levels, call the PostStreamLevelsLoaded function extracted from the original PostSeamlessTravel.
  • Override ReadyToStartMatch and return false if not all players have reported their PS.
  • override:
 bool AGameModeBase::ShouldSpawnAtStartSpot(AController* Player)
{
    return false;
}
winged badger
#

few minor corrections

#

you don't have to wait for all players to report to call PostStreamLevelsLoaded

#

you can, but don't have to

#

server has to finish before you call it, clients are optional

ember needle
#

HA

winged badger
#

server has to have all playerstarts generated

ember needle
#

EDITED ^

winged badger
#

you also don't have to server RPC client progress through the playerstate

#

you can do it via PC as well

#

its safer, as PlayerState usually takes its sweet time to replicate

ember needle
#

one last question (at least for now...):

"Override AGameMode::InitGameState, call Super, and fire a custom BlueprintImplementableEvent to populate the stream data that gets replicated to clients from the GameState"

does GameState exist at this point?

winged badger
#

you use PlayerStates to replicate progress if you want to show loading bars

#

it exists as soon as Super is executed

#

you can also do a bit of a convenience there if you like

#
UPROPERTY(BlueprintReadOnly) AMyGameState* MyGameState;

UFUNCTION(BlueprintImplementableEvent) void GameStateInitialized();

virtual void InitGameState() override
{
  Super::InitGameState();
  
  MyGameState = Cast<AMyGameState>(GameState);
  GameStateInitialized();
}
ember needle
#

ok, yet another question: what if I create all of the StartPlayer and then teleport the players after the server has loaded the stream levels?...

winged badger
#

this is better

#

doesn't create problems if you don't have enough player starts on persistent level

ember needle
#

humour me, this is a learning exercise for me ๐Ÿ™‚

#

let's say I have max 30 players in a game.

#

I create 30 player starts in the main level (empty)

#

every stream level has some references (actor arrows for all I care)

#

when server has finished loading the streams, teleport all players where needed, and also have ReadyToStartMatch return true

#

...bad?

winged badger
#

you could spawn all actors on persistent level without delaying HandleSeamlessTravelPlayer then

ember needle
#

not questioning you, quite the contrary

winged badger
#

and then teleport the players later

#

*all players

#

its just... less elegant

ember needle
#

indeed

winged badger
#

has an extra breaking point in it

#

more potential for bugs

ember needle
#

oh, which one?

#

ah ok

winged badger
#

the teleporting itself

ember needle
#

yes

#

definitely less elegant, however I've an added complexity that I didn't tell you about

#

the players equipment varies depending on where they spawn

#

closer to a center, less equipment

winged badger
#

then definitely no on teleport

#

HandleSeamlessTravelPlayer goes into HandleStartingNewPlayer

#

its default implementation spawns the player pawns

#

(you can override it from gamemode, have to call parent to have it spawn default pawns tho)

ember needle
#

ok gotcha

winged badger
#

or just spawn them manually

#

that is a good hook to handle equipment assignments

ember needle
#

so you're introducing a third option ๐Ÿ˜„

winged badger
#

and if you teleport after the fact

#

you don't have it

ember needle
#

so first option: all of the above
2nd option: teleport
3rd option: spawn manually (after server has loaded streams)

#

this is what you meant?

winged badger
#

spawn manually is only if needed

#

only if default implementation is not good enough

ember needle
#

i imagine that it kinda kills all of the normal flow