#multiplayer

1 messages Β· Page 572 of 1

winged badger
#

if its not AGameModeBase

chrome bay
#

Ah I guess that makes sense actually, since GS dispatches BeginPlay

#

Still.. I trust nothing πŸ˜„

#

FFastArraySerializer can only contain one array property yas?

#

Or can you have two in the same struct..

winged badger
#

it can have only one Items array

chrome bay
#

Oh duh ofc

#

the callbacks etc..

#

But also, dammit

#

I guess I can wrap two of those in yet another struct

winged badger
#

i am used to writing in fastarrays for pretty much everything nowdays

violet sentinel
#

current flow can be summarized by:
GameMode::PostLogin -> bunch of stuff -> RPC PC::ClientPrepare
PC now wait for the OnGameStateSet, calls other initialization, sends some update rpcs -> RPC to GameMode::PlayerReady
GameMode::OnPlayerJoin -> calls game-mode specific functions -> calls PC::ShowCharSelection

winged badger
#

there is one slight caveat with fastarrays

#

their item callbacks get called before the arrays OnRep does

chrome bay
#

yeah.. it also serializes the whole item each time IIRC

#

Which is the main annoyance in this case

#

Ah well

winged badger
#

unless you do delta for items

chrome bay
#

That might work

#

Actually, that would be heaps better. I'll do that

#

Has anyone done a NetDeltaSerialize for something that isn't a TArray?

winged badger
#

you can alternatively do the NetSerialize the way FHitResult does

#

pack a bunch of flags indicating which properties are serialized in that bunch

next fable
#

@chrome bay Thanks for the feedback on steam leaderboards and stats. I just published my first Steam game and trying to add a simple Kill/Death ratio... and been messing with it for 3 days.
My C++ is shaky and I don't want to write a library. I finally found a plug in that works for leaderboards.. but statts don't work at all..no idea why. Unfortunately the plugin author is MIA
https://nte.itch.io/steamuer

itch.io

Fills in missing functionality in the default UE4 Steam BP library

proven forum
#

Hey guys, good morning/afternoon. Quick question.

#

How can I trigger an overlap event only for the owning client in c++?

winged badger
#

you can adjust collisions so you get overlap only on clients

proven forum
#

I tried Pawn->IsLocallyControlled() and UFUNCTION(Client, Reliable) no luck 😦

chrome bay
#

Probably don't want to use network to send overlap events anyway

winged badger
#

you definitely don't

chrome bay
#

Good way to get kicked out of the server when something overlaps a few too many times

proven forum
#

I don't want it :P, but the trigger is happening in the server and all clients because the BP is on the level.

chrome bay
#

All you do is filter is after the event

#

The trigger should occur on all instances anyway because collision profiles etc. will be the same

winged badger
#

OtherActor->CastToPawn->IsLocallyControlled

proven forum
#

Thank you!, will do

#

you can adjust collisions so you get overlap only on clients
@winged badger not sure how can I do this

winged badger
#

that only works if you have a Pawn collision just for that overlap or just for local overlaps

proven forum
#

you mean something like this

winged badger
#

you simply turn it on if its locally controlled on BeginPlay

#

and leave it off for every other machine

#

then it wouldn't even trigger the overlap

proven forum
#
BoxComp->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
BoxComp->SetCollisionResponseToAllChannels(ECR_Ignore);
BoxComp->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
#

ohh got it!

#

that makes sense

#

Thank you

#

is a good solution

violet sentinel
#

another question: how to properly override default game mode player start selection.
by default game mode in InitNewPlayer calls FindPlayerStart, but by game mode rules need to wait for user to choose character/team.
current code just returns null in ChoosePlayerStart_Implementation and sets spawn point later, but the warning message remains and irritating me a bit

winged badger
#

c++ involved @violet sentinel ?

#

if so override this abomination in GameMode to just return false

#
    /** Return true if FindPlayerStart should use the StartSpot stored on Player instead of calling ChoosePlayerStart */
    virtual bool ShouldSpawnAtStartSpot(AController* Player);
violet sentinel
#

yeah, lots of cpp and blueprints mashed together

winged badger
#

when PC first loads/joins

#

GameMode runs FIndPlayerStart

violet sentinel
#

characters selected during game, spawn points selected during game (based on team or random)

winged badger
#

and caches it as StartSpot in PC

violet sentinel
#

yeah, i have AssignSpawnPointToPlayer(PC, PlayerStart) which does "assigning"

winged badger
#

this abomination of a function above is "optimization" so it doesn't run find again

#

but uses the StartSpot that was cached on join

#

it it returns false, ChoosePlayerStart will run normally after teams are selected

violet sentinel
#

the more i dig the more weird things i find.
"make this singleplayer game into a coop game" realises into a nightmare now

winged badger
#

been there, done that

sick totem
#

Is there a way to do multiplayer with blueprints connected to aws gamelift without paying $250 for a plugin to connect to aws? Or do I have to rewrite everything to C++?

#

I wrote a game in blueprints and now that i'm trying to add multiplayer with aws gamelift, I see a lot of issues.

inner sand
#

This is my join and create lobby code, it creates lobby then finds all lobies adds it to array then creates join buttons each with one session result attatched to them, I am set to 2 players running as clients and hosting server and finding server works fine but when trying to join server it fails

violet sentinel
#

@sick totem plugin is mostly a blueprint wrapper over c++ aws sdk. you can implement all needed features and expose them to blueprints in form of plugin or game module, but i don't think you can keep it as a blueprint-only project. we had to write own wrapper because management didn't want to pay for plugin.

ancient summit
#

Is there a blueprint way to make a projectile ignore his owner? I can’t find any working solution online 😦

sick totem
#

@violet sentinel Thanks! I'm pretty much a novice to this but do you have any tutorials or resources I should look into for help on this?

inner sand
#

elenby when projectile is released save owner name and then on collision check against it

violet sentinel
#

@sick totem there were some articles about aws sdk and some documentation, but don't think a tutorial about it. there were videos for the aws plugin, i don't remember anything else publicly available

ancient summit
#

@inner sand Great! that's a step lol, but now only the spawning client sees the ignoring projectile, even though the branch is on multicast

#

Solved it with "Ignore Actor When Moving". Thanks anyways πŸ™‚

twin sable
#

Does anyone here have experience using the replication graph? Is it suitable for use in a game where the host is also playing, without a seperate client for the server? I've seen a lot of references in the code to using framerate as a constant tick rate suggesting its designed for use where the server is running seperately with a fixed framerate. I'm wondering if anyone's heard of it being used with a combined game-server game

uneven cliff
#

Is anyone else using Steam Sockets, and if so, where is a source of info for it other than the plugin source code? I can't find anything other than how to enable it.

#

Like, just a couple example questions: in the source code for the plugin, it's trying to include header files which does exist, like steam/steam_api.h and I have the sdk which has those files, but do I just toss those in the core engine path, or should those exist in my project? There seems to be little to no info on this stuff.

#

I'm not married to the idea of Steam Sockets, but to my knowledge, it's the only way to accurately get the ping of a session without joining it (when using the steam subsystem), which is something pretty important for matchmaking

twin juniper
#

empty console when starting the ue4 server

uneven cliff
#

@twin juniper is there a question here, or are you just showing?

twin juniper
#

is question

uneven cliff
#

What is the problem you are having?

twin juniper
#

I start the built server, but the console is empty.

uneven cliff
#

If the problem is "when I start my dedicated server, it's not showing any information" you need to make sure you're passing the "-log" argument.
Like C:\MyGame\MyGame.exe -log

twin juniper
#

ye

#

but the console is empty

uneven cliff
#

I'm pretty sure you also need to specify a map to open in the same place, I'm just not sure what the parameter is

#

Yeah, so you have to tell the server to open up a map
MyGame.exe /Game/Maps/MyMap -log

floral crow
#

@twin juniper The flags we use when launching our server via console are: -server -nosteam -log LOG=ServerLog.txt

#

LOG=filename is just to specify a name for the log file

#

nosteam had to be added due to some issue we were having before, but I wasn't the one pulling the trigger so I don't know the exact details there

twin juniper
#

where to get logs?

#

they don't exist

#

@floral crow

floral crow
#

Saved/Logs/

twin juniper
#

empty

floral crow
#

If you still see no logs, make sure you are not cutting them when building

#

Building in Release mode almost sure prevents logging

twin juniper
#

there are no files in the folder

floral crow
#

There should be if you're following the steps

#

So my best guess is that your build configuration decided no logs were gonna be produced

twin juniper
#

okey i set dev build

floral crow
#

Yes

#

Try with that, and report back

twin juniper
#

hmm...

peak sentinel
#

is mouse location playerindex 0 only too like virtual joystick?

floral crow
#

hmm...
@twin juniper I'm sorry, I have no idea what that's about :/

twin juniper
#

I just needed to clean the ini. the warning was gone.

floral crow
#

Apparently, you can enable logging in shipping builds

dusk night
#

I'm using Advanced Sessions to create a session. Creating a session works, but I can't Find the session I just created. It always returns 0 sessions. Whtas up with that?

inner sand
#

In my code in the game mode I am getting the amount of players, making an array of player controllers and an array of start points, then looping through the arrays teleporting the player controlers pawn to the start point. There are no problems with the array though however the pawns are teleported to a random one of the start points instead of the corresponding one. Any help is much appreciated, been stuck on this for a while and I think I am just completely missing smithing

oblique inlet
#

I'm trying to spawn particles, if I spawn particles on the server with multicast it works fine however, if I do multicast on the client it works only on the client and if I do server on the client it only works on the server

#

how do I spawn particles on all?

#

I've tried calling a multicast, server and client function when the client fires but that did not work either

wicked brook
#

what are the particles for?

#

i do with server event from client.

oblique inlet
#

I got it to work this is what I did:

  if (HasAuthority())
    {
        MulticastFire();
    }
    else
    {
        ServerFire();
    }```
so serverfire is just calling multicast fire from the server
#

wait

lost inlet
#

a photograph of a computer screen πŸ€”

wicked brook
#

prob shouldnt use multicast btw

oblique inlet
#

why?

#

it's the only way I can get it to work if the server fires

wicked brook
#

what is it for? why would server need to call it?

#

what i do too sometimes is have the particle on an actor thats set to replicate then spawn that

oblique inlet
#

I could probably do something different when a client fires

#

but for listen server I have to use multicast

wicked brook
#

oh ok. i normally use dedicated so not sure about that way then

oblique inlet
#

still for dedicated, if I send particles to server only they don't get replicated to all clients

wicked brook
#

you mean if you call server event from client?

oblique inlet
#

yes

#

anyways it works for now, technical debt ftw

wicked brook
#

i mean yeah it should as long a you call from remote

oblique inlet
#

so if I'm the server I'm calling multicast from server
if I'm the client I'm calling multicast from server from client

#

it seems to work

wicked brook
#

if you client you should only call server event

oblique inlet
#

but then other clients don't see it

wicked brook
#

screenshot event you use to spawn the particle

oblique inlet
#

it's c++

#

I can still copypaste it if you want

wicked brook
#

yeah thats fine

oblique inlet
#
FHitResult Result;

    const float WeaponRange = 20000.f;
    const FVector StartTrace = FirstPersonCameraComponent->GetComponentLocation();
    const FVector EndTrace = (FirstPersonCameraComponent->GetForwardVector() * WeaponRange) + StartTrace;

    FCollisionQueryParams QueryParams = FCollisionQueryParams(SCENE_QUERY_STAT(WeaponTrace), false, this);

    if (GetWorld()->LineTraceSingleByChannel(Result, StartTrace, EndTrace, ECC_Visibility, QueryParams))
    {
        if (ImpactParticles)
        {
            UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ImpactParticles, FTransform(Result.ImpactNormal.Rotation(), Result.ImpactPoint));
        }
    }

    if (MuzzleParticles)
    {
        UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), MuzzleParticles, TP_Gun->GetSocketTransform(FName("Muzzle")));
    }```
#

and that's multicast

wicked brook
#

Yeah im not a pro at c++ but i dont see anything weird

#

you want me to show you how i do it in BP?

vale ermine
#

So I want to make a server client solution for my game. The player will be playing single player with option to join a map with another player. Now for the server solution. The server can only have one map. So I would need to make instance of every map. Because players will be playing these maps single player, I would not need to replicate. Does this mean I can have 1000 players all playing on the same instance but do not see each other playing? If the instance is over loaded spin up another?

#

The client would be built with all maps?

wicked brook
#

@vale ermine I think im confused by your question. Are you asking if the players offline will still be on the server but just not see each other?

vale ermine
#

no basically asking how I would go about having multiple players on one instance to reduce how many instances need to spin up. I need a scaling solution and I know the world map would need to be dedicated run 24/7. I just don't know how I would go about dedicated maps vs instance maps that are short lived.

wicked brook
#

Ah ok i see. What backend are you using?

#

Gamelift/ AWS can do that fairly easily

vale ermine
#

cost would be the biggest factor here in the design. Players see everything replicated on world map. When player selects a planet the see missions and can select one. This is when it would join an instance a bunch of players are on be each player is playing their on game.

#

i am using game spark for database and i want to use gamelift for server

wicked brook
#

world map wouldnt matter cause thats just local not server though right?

vale ermine
#

world map is server because when other players send out troops that will be replicated so other players can see where other players are sending troops

#

but all other maps can be instanced

pallid ember
#

hi guys how do I get the player index of each player in multiplayer?

wicked brook
#

so what would be offline?

pallid ember
winged badger
#

do not use player indices or GetPlayerXXX[Index] functions

#

getting player Index is super impractical

vale ermine
#

There is no offline but what I am trying to get at is. say someone clicked on mission 1. A instance spins up. player 2 clicks on mission 1. server sees that there is an instance that is not full. Server sends spawn locations for buildings enemys and other stuff to player. Last player competes mission. no more players on instance instance shuts down

#

i hope im thinking about this right

winged badger
#

i think running a bunch of instances will go over the specs of a commercial dedi

vale ermine
#

thats why I am trying to figure out the best way πŸ˜„

wicked brook
#

how many maps you talking about and how big?

winged badger
#

it usually runs at 2 cores and what, 8GB RAM or so?

#

you'll choke it to death imo

vale ermine
#

Ideally I would like to cram as many as i can get on one instance. Trying to figure out the pricing for that is not easy.

winged badger
#

yeah, but you don't have many world map instances

#

aka shards

#

no?

vale ermine
#

no I want to start with one. There is one main map everyone sees and rest is missions.

wicked brook
#

you would have to run it and test but for what you talking about spatialOS might be better?

winged badger
#

so anything you cram into it is a one time bonus

vale ermine
#

I did look into spatialOS and ran some test. The problem is that they do not keep their sdk up to date with the engine version

winged badger
#

spatial is for large persistent open worlds, not for world map + instances tho

wicked brook
#

im confused i thought thats what he was going for. never mind lol

winged badger
#

i got a feeling its more a guild wars type of setup

vale ermine
#

ever play lords mobile? its like that but space

winged badger
#

i never play anything mobile

wicked brook
#

πŸ˜„ to true. same here

vale ermine
#

So what Im thinking is that every player on the instance will have to spawn their own objects that do not replicate to other players that way I can have many players playing on one map. That seems like a lot of objects for the instance to handle.

wicked brook
#

how many is many?

vale ermine
#

well as many as it can handle I would not push it over that. Then I would spin up another if the first is full.

#

so every map needs to be compiled into its own server and needs to communicate with the lobby server so that I can manage what instances are spun up and handle closing them?

#

using game sparks databse to manage ip's and ports?

wicked brook
#

Honestly im not sure. im still kinda confused what you going for. I can tell you for instance with what i use on gamelift i have matchmaking set up that matches to which server/ instance i need if the instanced get to max alloted, a new server is started etc

inner sand
#

how do I get current session, I know find session exists though how do you get your session after you host it for ref

next fable
#

Anyone have any working code (BP or C++) to set/get Steam Stats?

gleaming niche
#

spacewar.

uneven cliff
#

Yeah. Spacewar in the steam SDK should have that

gleaming niche
#

you can include the SteamShared module, and then use the steamapi directly

next fable
#

Spacewar is not Unreal though right?

#

straight C++?

winged badger
#

you can use something like UWorks for wrapper

#

if you share a dislike for std with a lot of people here

next fable
#

thanks ... been looking at all those plugins on the marketplace .. big money.

uneven cliff
#

Last I checked, UWorks wasn't for sale anymore

peak sentinel
#

so i assume controllerrot having diffuculty with replication to others clients here, right?

#

there are more than 1 players and it just returns client 0

next fable
#

yeah UWorks is MIA
I found this plugin and it's free. It has all the code and BP integration.
https://nte.itch.io/steamuer
I got leaderboards to work fine... however stats don't work... and I haven't been able to figure it out. Going through Steam SDK docs like for 3 days.

itch.io

Fills in missing functionality in the default UE4 Steam BP library

uneven cliff
#

I've been using the Advanced Session plugin, though I've done nothing when it comes to actual interaction with steam other than getting the Steam username and creating/joining sessions. Annoyed by the ping issue though

#

@peak sentinel You're calling that print on the "remote" pin, which means it's not going to get called by anything that doesn't have authority, so it makes sense that it's only getting called once if there's two player (assuming one is client and one is server)

peak sentinel
#

normally it should have replicate to other clients & own client but, could this be about "mouse is local controller only"?

uneven cliff
#

Typically the ol' "replicates movement" handles this for me, but I assume you're changing the rotation somewhere else? If you're talking about mouse stuffs, then I assume you're directly setting the rotation, correct?

peak sentinel
#

yes, setting the rotation towards the mouse location

uneven cliff
#

Ok, so what you want to do is take the part of your function which sets the rotation, and turn that into an event which replicates to server. I'm pretty sure. Since you're setting the variable on the client... damn... I mean, try that, if that doesn't work, I'm going to link you to a doc I mean since I'm going to bed soon and won't be awake to explain it

peak sentinel
#

lol πŸ˜…

#

good night then πŸ˜„

uneven cliff
#

@peak sentinel https://docs.google.com/document/d/1tDduU4-V-fkymvmmtKf4GrFQQ2HUiqqM4N3Cdo3arV8/edit?usp=sharing in case you want a look, it's specifically about save and load games, but it's also about passing variables set on the client to the server

peak sentinel
#

okay, thanks

uneven cliff
#

np

neon mango
#

General MP question. What to do when logic depends on multiple replicated variables? It seems like not all clients have the variables replicated when trying to execute the code leading to mismatched results.

thin stratus
#

Send the data with an RPC or bundle the variables into a struct and repNotify it

neon mango
#

Ah ok

thin stratus
#

Each of the two ways is for different things though.

neon mango
#

Although I think my issue is something else for the moment. I'm having a hard time wrapping my head around what Types of Classes should call what types of "Executes On ..."

thin stratus
#

As RPCs only affect the users that are relevant and repNotify calling for everyone who's relevant and later for the ones that become relevant

neon mango
#

I feel like I'm having Client call server to only call client back again just to do something

#

I think I'm doing very silly things

#

Or have Server call Client only only to call server again

thin stratus
#

You only need rpcs if you need to move from server to client, client to server or server to all clients

neon mango
#

Are Events RPC?

#

I'm doing this all in BP

thin stratus
#

Custom Events that are marked as execute on iirc

neon mango
#

Like I'm trying to do a vote system

thin stratus
#

The term RPC is not a cpp only thing. It's a general term you should use

neon mango
#

I thought it would be easy

thin stratus
#

Did you read my compendium?

neon mango
#

but every time I try to predict the behavior

#

Something else happens

#

or rather doesen't

thin stratus
#

It's pinned to this channel

neon mango
#

Like Rep Notify has confused me so much, at first I'm like its Server to Clients only? Then wait says both?

#

Mean while it doesn't seem to do anything

#

and I don't know if that is because I'm calling it in the wrong class?

#

I have looked at

thin stratus
#

It's theoretically all explained in it

neon mango
#

Sadly My results are different or too specific

thin stratus
#

A voting system is relatively okayish

#

Not thaaaat specific

neon mango
#

I'm like having an Event called Casted Vote call a Server Casted vote

#

ecall a rep

#

only to call a Server Cast votee again

#

Its messy

#

It probably shouldn't be this messy

#

By rep I mean Rep Notify

thin stratus
#

You only need one server rpc to tell the server that you voted

#

And that rpc needs to be in a client owned class

#

E.g. Playercontroller, playerstate or playercharacter

neon mango
#

I think I'm just using everything all at once...

#

I don't know

#

Perhaps I'm using Rep Notify to do something an event is capable of doing just fine

thin stratus
#

Then start from scratch with it if it's too confusing

neon mango
#

Or vice versa

thin stratus
#

Maybe write it down first with pen and paper

neon mango
#

THis is my start from scratch project lol

#

I think Rep Notify just doesn't work how I think it does

thin stratus
#

At this point it might need someone to look at your code and explain to you what's wrong. I sadly don't have the time during the week to do that

neon mango
#

and it's throwing me for a spin

#

Well I'd pay someone for 30 min to an hour of their time to just walk me t hrough this

#

I think if it got explained to me first hand once I'd get it.

thin stratus
#

RepNotify is very simple. It's a normal replicated variable which calls the OnRep Function whenever a change to the variable gets replicated, including on the server when set.

#

At least in BP. In cpp it only calles on clients by default

neon mango
#

My experience tells me that is not the case.

#

Also Increment++ doesn't work...

thin stratus
#

Variable has to be set on the server

#

Cause replication is one way

neon mango
#

So if Client calls Game State Event which is set to "Executes On SErver"?

rich ridge
#

@neon mango is it actor or uobject where you are trying to update variable

thin stratus
#

GameState can't execute server rpcs

neon mango
#

Ah...

thin stratus
#

It's not owned by a client

neon mango
#

In your compendium it says it is shared by all

thin stratus
#

Yeah true

#

But that doesn't say it qualifies for server rpcs

neon mango
#

well...

#

How am i supposed to know that lol

thin stratus
#

By reading the ownership part of the compendium

neon mango
#

@rich ridge Game Sate?

rich ridge
#

It's and actor , and doesn't owned by client, so no rpc

thin stratus
#

(despite multicast)

rich ridge
#

You can do multicast

neon mango
#

I did that

#

still didn't work

thin stratus
#

But to go from client to server you need a server rpc

thin stratus
#

So you have to make one in a client owned actor

#

And from there access gamestate

neon mango
#

is UMG client owned Actor?

thin stratus
#

No

#

Not even replicated

rich ridge
#

Umg is client owned UObject

thin stratus
#

UI is something that should not have any replication in it

neon mango
#

hmmm?

#

Ok well that sounds like another problem in my code then

#

UMG was calling that Event i showed

thin stratus
#

Yeah

neon mango
#

So UMG should get Pawn then from pawn call that event in GameState?

rich ridge
#

As per your event name, PlayerCastedVote
What I understand is a player does server rpc, and then server does multicast.

thin stratus
#

UI Button Press - > PlayerController - > ServerRPC - > GameState - > Set Replicated Variable

neon mango
#

Ok think that is what I was getting out

#

I'll t ry that

thin stratus
#

And UI can then bind to the replicated variable or you make the variable repNotify and tell the ui to update if you want yo avoid binding

rich ridge
#

I think you are trying to do multicast from client

thin stratus
#

He's trying all sorts of things haha

neon mango
#

I thought from Compendium it was shared

#

And yes

#

Sort of trying all combinations of things

#

to see what sticks

#

lol

#

Brut Forcing it

#

not proud

thin stratus
#

Shared is correct

#

But you need to read the ownership part

neon mango
#

I guess I'm miss interpreting what is being taught there

#

furthering my spinningness

rich ridge
#

Apart from network compendium, you need to understand the underlying components like GameMode, GameState, etc

#

When these components are created..

#

For example PlayerState is created in Login function of GameMode.

thin stratus
#

The example i usually let peeps figure out is how to make a door that a client can open by pressing E and everyone else also sees it opening. (so server and other clients)

#

If you understand why you can't just call open on it or place a server RPC i to the door that's in the level you will already be a lot further

#

It's also close to your voting issue

neon mango
#

Yeah there is a lot to know, last time I did networking I used C++ and the Shooter Example to hold my hand. Now I'm doing this from scratch via BP and I did a lot of stuff on my own so far but voting for some reason confused me, probably because I also want to update the votes to all clients to show them in real time what is being casted

#

And I tend to do a log of logic in UMG

#

And I tried to do net logic in there too

#

Probably why there is no Has Authority Switch node in there

#

To discourage it

#

But that worked! @thin stratus and @rich ridge Thanks

random nymph
#

Can dataasset be replicated?

bitter oriole
#

Data assets are assets

#

There is nothing to replicate since they're supposed to be constant

random nymph
#

Hmm true

near bison
#

Blueprint Runtime Error: "Accessed None trying to read property CallFunc_K2_GetPawn_ReturnValue". Blueprint: BP_PlayerController Function: Execute Ubergraph BP Player Controller Graph: EventGraph Node: Add Movement Input

meager spade
#

cause you are trying to do it before pawn is possessed maybe? from those nodes, who can tell

#

so you have no possessed pawn or pressing input before pawn is possessed

near bison
#

Oh god, my gamemode had the wrong default pawn set

#

my bad

river estuary
#

There is nothing to replicate since they're supposed to be constant
@bitter oriole
When you say that I'm assuming all assets are deployed to both the client and the server.
Are there client-only/server-only assets?

bitter oriole
#

If they aren't, they can't replicate anyway.

#

Replicated actors are created on clients too and there is no built-in mechanism to download new assets from a server ; not that it's impossible to add such a feature

#

Though if you do create such a mechanism you still won't need replication on data assets, since... they're supposed to be constant.

winged badger
#

you can replicate a pointer to the static asset though

#

tell the clients "lets switch from dataasset A to B"

#

well, to B

umbral geyser
#

Hey guys im having a problem with my game when i get a client to join the server host the client has a black screen and cant see anything
(Im using the steam plugin)
(And following this tutorial
https://www.youtube.com/watch?v=ngBI40tjirE&ab_channel=UnrealEngine )

We continue working on our Find a Match screen by scripting how to populate and find available games to join. By the end of this video we have our basic multiplayer functionality in place and test out a server hosting a game while a client connects to that game. We also show r...

β–Ά Play video
dusky urchin
#

it seems to crash mostly when i don't have the headset on my head

#

there is a way for pass throught it ?

zinc owl
#

Amazon DB or Amazon RDS, which is better According to pricing, efficient in unreal using vaResT,For a Realtime Multiplayer shooting....

wheat magnet
#

why server can't see client event?, but client can see any client

#

i already running two custom event, 1 on server, and other on multicast

cedar finch
#

I have first person arms/weapons and third person arms/weapons. I can toggle between first person and third person by changing the active camera and setting the "set owner no see" on the arms/weapons accordingly. It works great but I can't figure out how to allow spectators to see the first person arms of the person they are spectating while keeping the first person arms hidden from other players alive. Ideas?

agile lotus
#

Whats an easy way to store a players nickname from their client so that it follows them into a server

twin juniper
#

index

#

uint 8 index playername

winged badger
#

@cedar finch don't use ownersee/nosee

#

do it manually, with IsLocallyControlled checks

#

then it won't automatically screw up spectators

fossil spoke
#

Anyone know of any resources on Push Model?

winged badger
#

i created my own

#

with NetworkManagerActors and FastArrays

#

can run any interactable Actor in the game through fastarrays there without the Actor itself being replicated

fossil spoke
#

Were the gains worth the effort to do that?

winged badger
#

oh yes

#

2200 >> 500 replicated Actors on the level

fossil spoke
#

Nice

winged badger
#

basically, my interaction works with Interface on Actor + InteractableComponent that does the heavy lifting

cedar finch
#

@winged badger Ahhh ok thanks πŸ™‚

winged badger
#

my FFastArraySerializerItems carry the snapshot of relevant parts of the InteractableComponent, a Timestamp and a uint8 Payload

#

which InteractableActors encode when they update the network managers on server and decode when fastarray callbacks call PostReplication (custom function) on them

fossil spoke
#

Oh so you transform the data back on the other end.

#

Right

winged badger
#

yeah

#

but network performance improved massively

#

has slight troubles coping late game prior to the change

fossil spoke
#

Though by the sounds of it, yours only works for this Interactable Component?

twin juniper
#

what is a push model?

winged badger
#

during the demo (after the change) we had a bug that allowed 16 players to connect instead of intended 8

#

and the game ran fine

fossil spoke
#

Manually marking properties as dirty for purposes of replication @twin juniper

#

Saves the Server from doing property state comparisons

#

Every rep update

twin juniper
#

Interesting.

winged badger
#

from what i heard about the built in one

#

its not quite there yet

fossil spoke
#

Yeah im finding that out as im reading into the code.

winged badger
#

as all the Actors are still replicated, so it doesn't save server from evaluating them

fossil spoke
#

I cant even check if a property has already been marked Dirty

winged badger
#

it just saves bandwidth

fossil spoke
#

Gotta save that mandwidth

winged badger
#

which is a secondary concern usually

fossil spoke
#

πŸ˜†

#

Yeah, im actually more interested in using it to avoid having to call a Multicast.

winged badger
#

my problem was with so many replicated actors, actors with short lifespan, like thrown grenade, sometimes wouldn't even show on clients during their lifetime

twin juniper
#

that makes sense.

winged badger
#

even after net priority adjustements

#

i just put 16 NetworkManager Actors on the 80kx80k level

#

had all InteractableActors register with the closest one and turn replication off on BeginPlay

fossil spoke
#

Not using RepGraph?

winged badger
#

no, didn't have time for it

fossil spoke
#

Ah

winged badger
#

i would had otherwise

fossil spoke
#

Its relatively easy/quick to setup if your not deviating from its already implemented nodes

winged badger
#

i made network manager system in 4 days, 2 weeks before the demo

fossil spoke
#

Ive had to put our RepGraph implementation on the backburner for now, to much other stuff to get done, plus ours will be extremely tailored thus increasing dev time to write it.

winged badger
#

nods

#

as long as you have a lot of Actors that fit the same replication pattern

#

this is awesome

#

as this has full benefits of a Push Model

#

the Actors need to be NetAddressable for this to work, obviously, as part of the replication payload is a pointer to the Actor

fossil spoke
#

No doubt

#

Im actually disappointed there is no native PostReplication function

winged badger
#

at least the name wasn't taken πŸ˜„

fossil spoke
#

Heh

winged badger
#

you do have PostNetReceive tho

#

it runs after all OnReps

fossil spoke
#

Hmmm i forgot about that one

#

Thats only on the Client side though yeh?

winged badger
#

yeah

fossil spoke
#

Ehh

winged badger
#

its where the client side BeginPlay gets called from

fossil spoke
#

Makes sense

steel vault
#

Question about spawning a large amount of replicated actors (projectiles). It seems that if they have a lifetime of say 20 seconds and I shoot even 10-20 into the air so they arent getting destroyed it seems that the continual spawning/shooting of more projectiles slows down client side and looks more sparse. Is this due to the continual creation of so many replicated actors or should I be optimizing how they move or update? I’m unsure where my bottleneck lies.

#

But shooting at the ground they spawn just fine and continual on the client

fossil spoke
#

Do they get destroyed when they hit the ground?

steel vault
#

Yes

#

They are replicated spawned by server with projectile movement component and when they overlap on server they get destroyed

meager spade
#

thing is, if they never actually overlap something to be destroyed, they will just persist

steel vault
#

So if I’m on the client shooting at the ground no problem but as soon as I shoot into the air it starts to slow how many I see coming out

#

Is it really that big of an issue to replicate 20 moving actors like that?

#

Seems to stress things out for my client badly

#

As soon as they die in the air its back to smooth shooting again. Server has no issue shooting into the air

#

Is it rare for games to have that many actors ticking movement? I would think that should be fine

fossil spoke
#

Given that when you shoot at the ground your most likely not having multiple alive at once, however when shooting into the air, many are alive together.

#

Also it may not be a network bandwidth issue, it could be a processing bottleneck.

#

You really need to profile it.

#

A good place to start is stat UObjects

#

Then get familiar with the Session Frontend and its profiling tools.

steel vault
#

Hmm I find it strange that it could be a processing bottleneck though if the server is fine doing the same action without a hitch. Do those tools handle network bandwidth measurements? That could tell me more of a story

fossil spoke
#

If its a Client Side issue its more likely processing/graphics related than network.

#

Again, profile it.

#

There are network profiling tools.

#

Network Insights

#

For example

#

But its only available with 4.25 IIRC

steel vault
#

Ok. Im on the latest 4.25. I’ll look at some videos and see what I find thanks.

dusk night
#

If I don't want to use Steam, is there any alternative OnlineSubsystem to use? Ideally one that doesn't require an external client running?

twin juniper
#

@dusk night Explanation of a Subsystem is a heavy use of services without Unreal Engine. Even when you use Epic Online Services whenever it's plug-in external services is needed to function depending on what extent. Theirs security practices that block you and not suitable/comfortable for gamers to develop. It's basically software engineering practices to enable players. Which the answer is a very slim yes and no, meaning you must create yourself.

dusk night
#

In my case I just need really basic functionality to have sessions and relay network traffic so online games work outside of LAN. I'm hoping the Epic Online Services plugin(when it comes out) doesn't require the client running.

twin juniper
#

@dusk night It's software engineering practices, you'll always need to have a client and a host it's the basis of things. Unreal Engine doesn't allow host migrations due to multiple issues with cheaters I believe. Also I highly doubt Unreal Engine will be paying for everyone's dedicated server. That will easily reach past 100 million on top of millions. What's your end goal... What do you mean you don't want to have a client?

#

@dusk night Pace yourself and take time studying Computer Science an you'll be able to sit-back and easily tackle everything you need to like a champ

dusk night
#

I'm already quite familiar with networking. The players would be hosting the server(listen server). Its just the Online Subsystem is used as a relay server to get around NAT issues.

inner sand
#

I am p new to replication, trying to set billboards to hidden with a simple unreplicated event. When I call the event of a keyboard press it works but if I do it off any other part of the graph it doesn’t, any explanation would be very helpful

twin juniper
#

I use C++ so I don't understand.Sorry

strong vapor
#

@inner sand are you saying it doesnt trigger from other logic on the graph?

#

stuff that might be happenign on the server?

#

the keypress is something the client does.. so it is happening on the machine that does it

#

but if you're trying to do something from any where else on a graph that might be getting execution from the server.. it wont work on clients

#

unless you replicate it somehow.. either with an RPC or a replicated property.. enums are nice for state replication

#

use that repnotify

#

dont know if any of that helps

inner sand
#

So I take it I can’t just call it off the end of my event begin play. I am trying to make its so that only you can’t see the billboard. Is there anyother way It be considered run by client. Even the option to Run on owning client doesn’t seem to do anything

strong vapor
#

on begin play it should happen on both machines

#

server and client

#

have you tried restarting the editor?

inner sand
#

Nvm got it to kind of work, just needed to put a delay after begin play, It looks like a bunch of stuff was getting loaded before it possessed the pawn, possessing the pawn was called before but I guess it just takes time to execute

strong vapor
#

aaahhh oh yea those race conditions'll get ya

inner sand
#

Race condition?

strong vapor
#

well im not sure if thats the right word for it

#

race condition is where like... 2 things are trying to call eachothers variables on begin play

#

and its like... one of them cant be initialized yet before the other one is trying to find it

#

so delays are super simple way to handle it

#

but then you forget about what you delayed and where and it gets messy

inner sand
#

Oh, thanks I imagine that’ll come up again

strong vapor
#

delegates are super nice cause its like... "whenever this is done.. let people know"

inner sand
#

Replication is more an art than a science

strong vapor
#

so you can be like "initialize this after this other thing fires its ImDone delegate"

#

lololol uhhhh

#

im finding that out now with optimizing lol yea

#

but its good to know the science

winged badger
#

Pawn/Controller thing is not a race condition though

strong vapor
#

yeaaa i knew it

#

lol

winged badger
#

its just a sync execution

strong vapor
#

i fucked that up

inner sand
#

Anyhow I’ll check out delegation

strong vapor
#

his problem is probably because something hasnt been replicated yet right on begin play

#

right Zlo?

#

if that delay fixes it.. that's probably what it is

winged badger
#

client has controller on BeginPlay

strong vapor
#

i'd maybe make a comment anywhere you make a delay and have a shared word.. that way you can look it up in your findall

#

later on

winged badger
#

as there is no possessing done there, its just a replicated Controller variable, and those are set prior to BeginPlay

inner sand
#

Yeah just did thay

strong vapor
#

gotchya

#

man not even my problem and im learnin

winged badger
#

anyhow, there is always a way to avoid delay nodes

inner sand
#

I’m possessing a character I spawn in on begin play

winged badger
#

which will bury you as you add complexity

inner sand
#

Makes sense

strong vapor
#

yea and they're not reliable.. like if there's super laggy conditions

winged badger
#

when you have 50 things initializing in order

strong vapor
#

maybe that delay wont work

winged badger
#

good luck timing the delays

strong vapor
#

i like delegates

#

the day i found out about delegates i let out a big loud "hooraaayy"

#

lolol

inner sand
#

Are delegates c++ only cant find anything in blueprints

twin juniper
#

what are you playing as Zlo?

winged badger
#

ah, im just looking at some UI atm

strong vapor
#

you can do em in blueprint

#

lemme do a screenshot

#

see where it says event dispatchers at the bottom

#

you click the plus button.. dont worry about giving a signature

#

you can add inputs

#

you can have other scripts "bind event to YourEvent" as well

inner sand
#

oh event dispatchers

strong vapor
#

yeaaa

inner sand
#

got itttt

strong vapor
#

they're called delegates in the code world

#

i came from C# in unity

#

but now that im thinking

inner sand
#

Ive just used casting for everything

#

guess thats alot cleaner

strong vapor
#

uhh no this isnt somethign to do with casting i dont think

#

you would still have to cast to bind the event from whatever you're trying to get the data too

#

one moment, screenshot

inner sand
#

no i get what ur saying I think

uneven cliff
#

They're really helpful when you start using design patterns

inner sand
#

but u need a rferece from what ur casting to to the caster with delegates, usually other way around

strong vapor
#

here's me inside a FortressActor (its got a castle mesh and some spawn points) and it spawns guys and then binds an event to their health change...

inner sand
#

cool cool, the variable change ones are going to be very useful

strong vapor
#

replicated properties are the way to go for variable changes i think

#

like.. ill fire my delegate in my "repnotify" function from my replicated variables

#

you know what i mean?

#

then anything on the client side thats bound to the delegate will get it right when it gets replicated

lucid vault
#

Anyone familiar with UCharacterMovementComponent? I want to disable location replication whilst keeping replicate movement enabled. I'm trying to figure out how to do this in my custom movement component

#

Essentially, I want to replicate everything normally (character rotation, for instance) but not the location. I want to do custom client authoritative location replication with interpolation

inner sand
#

I figured out that my code works while their is a delay even if the delay is zero seconds, not a problem just thought it was weird

strong vapor
#

delay of zero means one frame

#

@lucid vault dont know of a checkbox that lets you do that.. might have to change source.. i made a pawn class that i put a skeletal mesh on and replicated movement..

winged badger
#

@fossil spoke yeah, my network managers only work for InteractableActors with InteractableComponent, but those are over 75% of my Actors (doors, windows, loot lockers, power switches, terminals...)

#

it could easily support additional different Actors, but it would require writing an additional FastArray for the NetworkManagerActors for each replication pattern you'd need to support

fossil spoke
#

Yeah figured

winged badger
#

i do have 2 FastArrays, 2nd uses an extended FFastArraySerializerItem, this one also able to carry the payload from DamagableInterface

#

since some of our InteractableActors can also be damaged and destroyed

#

the entire system was around 600 lines of code, so much less then i originally expected

pallid ember
#

what is the player index of the client in a 2 player game? 1? why is Get Camera Manager with player index 1 returning nothing?

bitter oriole
#

Clients don't have access to other player's PlayerController or related classes

pallid ember
#

@bitter oriole okay then how can I access clients camera ?

#

because right now in my Character blueprint which is for both server and client

#

its using the same camera (servers)

#

im getting the forward vector on the actors camera to do calculations

bitter oriole
#

Get the Character that you want the camera for, and get its camera.

#

The camera manager is player-based, not character-based, and players are not replicated while characters are.

pallid ember
#

@bitter oriole how do I get the character?

#

get player character still requires the index

bitter oriole
#

Player index simply is not a multiplayer concept

#

You need to use some other logic to get characters

pallid ember
#

i dont get it

#

what node do i use to grab the character? both client and server uses the same character blueprint

bitter oriole
#

Iterate on all characters and find one that isn't locally controlled, for example

kindred widget
#

GetPlayerCharacter(0) will always return the local machine's character pointer. It relies on the player controller list. On a Listenserver PlayerController0 is the listenserver's controller, on any client there's only one controller, so they're also PlayerController0

bitter oriole
#

You can also iterate on player states, find the other player's, get the pawn from there

pallid ember
#

ohhh I see so get all actors by class and then find the one

bitter oriole
#

It really depends on what you're trying to do

pallid ember
#

well I am trying to get the forward vector of the given player

#

to do some calculations right now whats happening is that its using the server (player 0)

#

i understand that get player camera manager is not going to get me what i need

kindred widget
#

Do you need this information on a client or the server? And if it's on the server, do you need it for a client's character?

pallid ember
#

good question I need this information on the client and server...

#

im using it to apply the vectors to an AddIpulse....basically each player gets to throw a ball

#

and right now the direction is fixed (it uses the servers forward vector)

kindred widget
#

I think part of the problem here is that you're going outside of the character to get the character. You're already in the character. When you have two players, you have four characters. Two are locally owned by their machines and these are what receive input events like your InputActionThrow there. So when you press a button on that machine, that machine's locally owned version of the character plays it. That means only one out of those four characters plays that input when one person clicks. So what you do, is make an RPC to the server like you did right after the event. You can either pass in an aiming vector from the client saying "I want to aim here", or you can use this instance of the pawn on the server to figure out your aiming vector, probably based on BaseAim or location of the camera, etc. You shouldn't need any calls like GetPlayerCharacter or CameraManager here.

karmic briar
#

Get Controlled Pawn?

pallid ember
#

so maybe I need to call the RPC after running it on the client?

#

I am using where the player is looking to get the direction and feed it into the vector...so you are saying I should pass this vector to the RPC

soft shell
#

(in playing in the editor) my level has an actor who (on the server) spawns another actor and stores it in a RepNotify variables.. then in the OnRep_XX function it calls an interface on that actor.. When the level loads the OnRep_XX fires on the server; however when clients arrive they don't call the OnRep_XX - I'm pretty sure all replication is OK, etc.. If I add a 5 second delay in the initial actor so it does not spawn it (and store it in the RepNotify variable) for a few seconds, it works.. I thought OnRep_XX fire for clients joining when they get the network copy of the actor.. what am I missing?

gleaming niche
#

onreps only call when something changes. If they join, they receive the actor in it's current state, thus, no onrep.

soft shell
#

Ah ok, so the actors once replicated to the joining clients will have the variable set (and available in BeginPlay) -thanks

pallid ember
#

@kindred widget ohhh I think I see what you mean now

pallid ember
#

@kindred widget fixed it via using Camera location and getting forward vector from that! was using base aim rotator but it was giving a Quaternion

peak sentinel
#

Using OnRep for a variable that changes every tick (variable comes from an input) or processing everything in tick and calling functions

#

Which one is better?

chrome bay
#

OnRep

#

You won't get all the updates anyway if it changes every frame

#

And calling an RPC on tick is a good way to kill your server

#

@gleaming niche @soft shell You will get an OnRep during a join in progress

#

OnRep will be called if the value differs from the construction-time value

lucid vault
#

@strong vapor I indeed need to modify the source, or at least a subclass

#

I'm just not too familiar with the CMC. I'm looking through it for a place to disable location replication

gleaming niche
#

@chrome bay i'ev always had to manually call the OnRep for things that rely on the OnRep to be called, from PostNetInit or whatever, because they would never call for me. I have no idea about blueprint ones though.

#

i no longer have many that rely on it, because of that

thin stratus
#

If I TearOff() an Actor on the Server before calling Destroy(), shouldn't that NOT Destroy the Actor on the Client?

#

Do I need to wait a frame so this doesn't happen? It seems to skip the TearOff check on the Client ;-;

knotty folio
#

What do I need to do to setup my game in UE for online multiplayer? Setup so that the clients/players can connect to Google/some other server working as a host. Thanks!

winged badger
#

@gleaming niche you sure you didn't manually break the engine there?

chrome bay
#

tbh in Blueprint anything is possible πŸ˜„

winged badger
#

blueprint doesn't even have OnRep

chrome bay
#

Yeah that have that awful fake on rep

winged badger
#

its a callback from IPropertyChangedTracker, definitely not a replication callback

chrome bay
#

me no likey

winged badger
#

its just terrible

chrome bay
#

also.. it's get called on the server

#

why

thin stratus
#

OnReps calling before BeginPlay is fun too

#

"Oh your logic relies on BeginPlay having called? Too bad!"

winged badger
#

thats client or deferred spawn in BP

thin stratus
#

Yop, hot joining clients mostly

#

It's fun

winged badger
#

i usually do deferred spawns for everything so that i can use unified BeginPlay logic on client/server

thin stratus
#

I'm a bit annoyed at Epic's tear off logic

#

If I tear off and destroy I don't want to have it destroyed on the client

#

Yet TearOff has to replicate first? wtf?

winged badger
#

and for that it has to be not destroyed long enough for net driver to get off its arse and send it

#

πŸ˜„

thin stratus
#

Yeah which is a gamble

winged badger
#

just elegant

thin stratus
#

I wonder if I can set Replicates to false

#

But then it's not teared off either

#

oh man

winged badger
#

you can

#

or you can turn it full dormant

chrome bay
#

My fave thing is replication graph, which doesn't destroy actors until they are relevant again

winged badger
#

but that carries another bag of cats

thin stratus
#

It's such a simple concept: Destroy Actor on Server without it destroying on the Client, because the Client will take care of it itself.

winged badger
#

when a client enters relevancy range it will not get its last update if you do either of those

chrome bay
#

boy oh boy πŸ˜„

thin stratus
winged badger
#

i usually just hide/disable mine, set lifetime for 10 or so seconds

thin stratus
#

:perfect:

winged badger
#

but yeah, however you look at a concept of destroying replicated Actor on server only

thin stratus
#

It's fine if this is for visuals

winged badger
#

its a chicken or the egg scenario

thin stratus
#

But the Client needs data from the Actor before destroying it

#

If the client lags and doesn't perform that logic, I have an issue :D

#

Guess I store the data at teh start and use it at the end, no caring about the pointer anymore

winged badger
#

i don't have that problem, as most of my Actors don't replicate over their own channels in the first place

#

and have replication off

gleaming niche
#

so bp's repnotify doesn't actually have anything to do with replication?

winged badger
#

no, its property changed callback

#

you can set property on client locally, and OnRep will fire

#

its just... bad

gleaming niche
#

oof.

lilac bear
#

@thin stratus @winged badger @chrome bay you guys rock, love these 'gotcha' traps you are covering in UE4 πŸ™‚ thanks for stepping on the landmines and sharing your pain so we hopefully won't repeat the same πŸ˜…

thin stratus
#

Oh you will repeat. Every single painful step. Don't you worry :D

lilac bear
#

lol

meager spade
#

@chrome bay that explains why in fortnite, you see things and boom, they just dissapear in front of your eyes LOL

chrome bay
#

figures πŸ˜„

peak sentinel
#

OnReps calling before BeginPlay is fun too
i was about to use onrep and this just saved me 30 mins before i rage quit unreal and try to solve why engine crashed

winged badger
#

OnReps calling before BeginPlay is one of the most convenient contracts in unreal networking imo

#

(after you are aware of the fact, you can structure the code to take advantage of that)

dusk night
#

What happened to the "Auto Connect To Server" checkbox in the advanced multiplayer options?

thin stratus
#

It merged into the DropDown that lets you select if you want to play Offline or not

neon mango
#

What is the difference between a Net Multicast and Just having the server Loop through all players and calling a RPC that is set to Replicate for Owning Client?

chrome bay
#

Can't call a client function on an object a player doesn't own

#

You can call a NetMulticast on a random box in a level for example, that all players can see, but not a client function.

neon mango
#

Yes but in the example I give the RPC is on the pawn

#

In case that wasn't clear

#

so is there a difference aside from how it is being called?

winged badger
#

same applies

#

as you can only client RPC to one Player from there

neon mango
#

to one player?

winged badger
#

difference comes in Reliable vs. Unreliable RPCs

#

Multicasts

neon mango
#

So if server game mode loops through all players from Game State and calls an Owning Client RPC is that functionally different from just doing a Net Multi Cast there instead?

winged badger
#

Reliable ones get fired immediately, unrealiable ones do not

neon mango
#

Don't they all have reliable/unreliable flags?

winged badger
#

well, you can't really multicast from a gamemode πŸ˜„

chrome bay
#

Nobody owns the gamestate, so none of them will receive a client function

#

And server won't call one

neon mango
#

Hmm

#

I'm not sure I'm not clear or just confused

#

It gets called

chrome bay
#

You can only call a Client RPC on an object that a Client owns

winged badger
#

you can loop through player controllers

#

and RPC each one

neon mango
#

yes

chrome bay
#

And only that client will receive it

neon mango
#

that is what I've done Zlo

#

So would it be better to just do a Net Multi Cast somewhere else?

#

Or is that just fine?

winged badger
#

my very much preferred way of doing it for something important

#

there is also the bit where multicasts take relevancy into account

neon mango
#

So you would approve of me doing that? it is a wise thing to do?

winged badger
#

i do that for my match end info/screens

neon mango
#

Which is what I'm doing right now

winged badger
#

as does Jambax if im not mistaken

neon mango
#

My understanding has moved me to do that for my Player Vote screen

#

But before I was doinig Net Multi Cast and seemed to get the same behavior

#

so wasn't sure which was best

winged badger
#

direct client RPC doesn't have some border conditions multicasts do

#

that can cause them to fail

neon mango
#

That sounds handy to know

winged badger
#

like being out of relevancy

neon mango
#

ok

winged badger
#

btw, most efficient way to do it from BP

#

is GameMode -> GetNumPlayers -> For (0 to NumPlayers - 1) -> GetPlayerController[Index] -> Cast + RPC

#

the only use of GetPlayerController[Index] i approve of πŸ˜„

neon mango
winged badger
#

slightly, if you start from GameMode

#

it has an extra layer of indirection

#

but its fine

neon mango
#

ok

winged badger
#

the above one is basically loop through all PCs in blueprint

#

the PlayerState version will fail if the World didn't BeginPlay yet

#

as the array will be empty

neon mango
#

Good point, but that shouldn't happen if nobody is around

#

the vote screen that is

winged badger
#

yeah, but there is a way that can come to fail

#

say you seamless travel into the map

#

and you override GM's ReadyToStartMatch to return true only after NumTravellingPlayers is 0

#

this is the scenario where you can have 3 players fully loaded, 4th still loading and BeginPlay didn't start yet

neon mango
#

Can't a lobby solve that?

#

Where you only start the actual game once everyone is in?

winged badger
#

my point is

#

PlayerArray is populated when PlayerStates call BeginPlay

#

and register with GameState

neon mango
#

But PC is always good to go

winged badger
#

before they do that, the PlayerArray is useless

neon mango
#

My issue with PC is that they don't possess pawn until some time after they join

#

I didn't want to have to use a delay there

winged badger
#

ofc, does your RPC more naturally belong in PC or Pawn is also a question

#

(PlayerState can RPC as well btw)

neon mango
#

I guess this is why Shooter Example does all this in PC, I recall them doing that at least now I know why

winged badger
#

voting stuff thats visible to all players belongs more naturally in the PlayerState imo

neon mango
#

Well the votes var is in there, in PS

winged badger
#

then send the RPC through the PS

neon mango
#

So Report should just be in PS?

#

Not in Pawn

winged badger
#

Pawn doesn't need to know about it

#

correct?

neon mango
#

hmm I think not

winged badger
#

now you have a PlayerState accessing Pawn to send a RPC for the Pawn to access PlayerState and set the variable

#

2 steps in this chain don't need to be there πŸ˜„

neon mango
#

Yes... tell me about it, this is what it's been feeling like

#

No shooter C++ code to hold my hand

#

I'd just peak in there and be like, oh they are doing things this ways lets copy

#

but now I'm going solo

#

and I'm doing silly things

neon mango
#

What is the best practice in terms of interactive events? I just realized another silly thing I was doing that was leading to Interactive events happening twice.

I made my "Fire" event Server RPC call so that when Client "Fires" it tells the server to try and do the same thing but then on top of that I was having other RPC events get called if Client was doing the Fire to tell server to do those events leading to them happening twice.

A simple solution would be to just not make those events fire a second time client side and just let the server verify that the hit occurs but I have a situation now that since Rag Doll physics doesn't rep and this needs to happen on the ragdoll that I'd need to trust that Client is seeing the rag doll where they are meaning I can't strictly depend on server verifying the hit since server and client rag dolls usually wont' match.

I guess this forces me to use a death animation? That should then match server/client but is Rag Doll really out of the question?

steel vault
#

You could replicate the position of the ragdoll mesh and move your client ragdoll to the same position

#

Using impulses

#

I have tried this myself and it works for the most part but there are still some bugs/caveats that I have yet to figure out.

#

The client ragdoll jitters pretty badly and sometimes the ragdoll disappears completely if the client isn't looking at it.

peak sentinel
#

I wonder how other people make multiplayer games with this lack of documentation/knowledge about networking in UE4

#

Even replicating a ragdoll movement requires tons of research πŸ˜„

neon mango
#

There is UDN Unreal Developer Network that I know you can pay for to get better more direct INfo

#

never used it

#

and I don't know if you need to be a certain company to get access to it

peak sentinel
#

How much they ask for?

neon mango
#

No idea

#

Never used it

#

Just know it exists

peak sentinel
#

I mean look at my name, i could call them every second πŸ˜„

steel vault
#

Yea it's almost remarkable to me how solo/indie devs even manage to release a product. The amount of work to just learn how to do things the first time around is crazy, and then optimizing and doing them correctly too.

neon mango
#

Not everyone is in the same situation. Some people have more time, some people are more disciplined, have fewer distractions in life, etc...

steel vault
#

Some have the advantage of working in the industry amongst other professionals at a AAA studio and know the ins and outs.

neon mango
#

I seem to be in a pocket where no one around me even in my profession want to make games on the side or collaborate for that matter.

steel vault
#

That's probably the biggest advantage that I lack.

peak sentinel
#

Nobody asks to learn matchmaking or making advanced wall running system with replication in 1 day

#

But least essentials should be documentated

neon mango
#

unreal docs are slowly improving, them taking down the Wiki was the worst move ever

peak sentinel
#

Like no docs. teach you about you should check for if controller is valid before coding inputs

#

or no docs. explain how you can make a "only* owner see" mesh visible for spectator actors

#

you should come here and beg for help from people who did it before

neon mango
#

Seriously the knowledgably people here who take there time day after day to answer mainly old questions are true heros.

peak sentinel
#

totally agree

neon mango
#

And they are a handful

#

I sadly am one of those that just comes in to ask questions but when I do if I can answer another question someone posts that I know the answer to i will do so

steel vault
#

Yep. There is no lack of respect for the experts who answer questions like that. I hope one day to be able to repay it myself.

peak sentinel
#

But after all the knowledgably people in community carries the responsibility of Epic which they dont need to actually, I am surprised they have a paid service to help the companies

#

Having a Unreal Slackers in the community urges them to "not improving docs"

steel vault
#

Yea I definitely do agree that with all of the money they bring in they could pay a few positions or a department to release some short tutorial series that cover specific things in depth to help the community understand things better. Or maybe they do that? I haven't found anything.

peak sentinel
#

With the upcoming updates they also update the docs but most of the docs and espeacially youtube videos are mediocre

steel vault
#

Yea their videos are like 2 hour long mess around and talk sessions nothing that is tailored or directed at specific tasks or learning.

peak sentinel
#

I saw a YT video which uploaded by UE about replication, the "network engineer" who was tutoring just added a server function to "spawn projectile" weapon then video ended

dusk night
#

Why is replicating TMaps not supported?

twin juniper
#

@dusk night Another good question J, I believe Unreal Engine only support UPROPERTYS A UPROPERTY,or it's just a UPROPERTY that's simply not replicated.. I believe is something that can be enabled in editor to view and a ton of other low level stuff within ue4. Simply to say, I don't know their framework. But to me they just didn't, Either way work around it

#

@dusk night Best bet when you encounter issues like that spend a little good time to see if it's your fault. If not work around it

#

What are you working on sounds interesting a shooter or rpg?

dusk night
#

TMaps can be UPROPERTYs, they have give an error when you try to replicate or RPC them.

#

strategy

twin juniper
#

Cool, Well spend time to see if it's your fault. Make sure you check things you need to if not,think about it you spent a good amount of studying checking for human error. IF your satisfied to with your time spent on research work around and don't waste to much time researching

dusk night
#

I found a forum post from 2015 from Tim Sweeney "That's great news! Implementing a UMapProperty and supporting TMap replication was on my todo list in 1998." I guess they never did get around to it.

#

lol

twin juniper
#

lol

#

Yup, take that into practice. How long did you waste researching and how far would you be if you worked around. Good practice, then when you find something put it back in.

inner sand
#

Simple Replication question that is giving me a lot of trouble, I am calling an event as server in game state that is multicasted, after key is pressed. The event has seemingly no ouput whatsoever though. It is supposed to set a billboard component to hidden and then print something. any help much appreciated.

#

event called from player controller

fossil spoke
#

@inner sand Dedicated Server?

inner sand
#

no client only

#

oh nvm

fossil spoke
#

....

inner sand
#

that is dedicated server

fossil spoke
#

So yes lol

inner sand
#

sorry

fossil spoke
#

Ok

#

Well Clients cannot invoke RPCs to other Clients

inner sand
#

RPC?

fossil spoke
#

Your Key input is on the Client side

#

Therefore your SwitchHasAuthority will always read as Remote

inner sand
#

So the input would need to be from the server

fossil spoke
#

Or

#

Your Client sends an RPC to the Server that tells the Server you provided input, then the Server sends the Multicast RPC

inner sand
#

so i do a run on server event

#

that calls a multicast

fossil spoke
#

Run On Server - Client sending info to Server
Run On Client - Server sending info to Client
Multicast - Server sending info to everyone

#

These are the different types of RPCs

#

So yes you are correct.

inner sand
fossil spoke
#

You need to remove the SwitchHasAuthority node FYI

#

Remember, player input is on the Client side, therefore the Authority pin will never execute

inner sand
#

removed the switch that still doesnt seem to do it

fossil spoke
#

You cannot connect these this way.

#

You have broken the execution line.

#

Also you have called an RPC. Any information you want to use on the other side of the RPC you need to pass through or access in another way.

inner sand
#

I make a replicated Variable and Set it, that should fix it right. Also what is an RPC, is it just any Replicated event?

fossil spoke
#

Remote Procedure Call

#

Create a parameter on the RPC like you would normally, it passes that along.

inner sand
#

k got it

inner sand
#

Looks really helpful, acutally explains stuff, was working of some yt tutorials and trying to adapt it to fit my project and wasn't getting anywhere

#

added a param on custom event zero so it passes through that now, however it isnt setting it to hidden let alone printing it so I don't think it is the variable I think it is just not getting called at all

peak sentinel
keen warren
#

i have a small question. about my dedicated server and multiplayer. Id like to cast a server event that starts when server boots. but i guess im unclear which blueprint it should be in. Multiplayer and replication still a bit fuzzy for me.

peak sentinel
#

there is an onrep event for ControllerRot but it is not firing
i wasnt calling Super:: kappa

#

still dont work tho

inner sand
#

@keen warren I think you would want to run that in the game mode, unless it is a player specific event

keen warren
#

i boot into loginMode login screen. then continue into mainMode. mainmap

#

hmm

#

i think might be fumbling over my own feet here.

#

so i can safely put this server event in the login game mode. because clients wont cause a trigger. and login game mode is compiled by the dedicated server ?

#

@inner sand

#

but then i switch game modes. so i dont know what im doing

inner sand
#

The game mode is only exists in you server, I think that maybe you could move your game mode code to your game state and switch that. As long as you don't switch your game mode mid match you should be fine.

unkempt tiger
#

does each RPC mean a single packet?

#

Or does the engine somehow package RPCs together if say, they all occur on the same tick?

#

might have asked this but forgot

west mason
#

well that was fun

#

i remade a prototype i'd made in 4.10, only with 4.25 character movement interp it becomes choppy as all hell

#

i really wonder how did the 4.10 charactermovementcomponent manage dashes and teleports so smoothly and the 4.25 just completely fails

west mason
#

It feels like it's completely ignoring all the network settings

distant plover
#

Anyone here know of any common issues with 4.25 that keep people from connecting to your hosted game? Servers won't populate in the list to join

peak sentinel
#

so i have replicated my rotation via onrep (as Zlo recommended like this), but its not replicated at all

quick stag
#

Been doing a bunch of research on listen servers, and I have a couple questions if anyone has the time to answer them.

Can listen servers use Multiplayer Origin Rebasing for all players?

Can listen servers use Level Streaming?

timid moss
#

Does anyone know exactly what variables need to be marked to replicate when using FFastArraySerilizer?

#

Should the FFastArraySerilizer be replicated?

#

And theres also the FFastArraySerilizerItem. Does that need to be replicated?

winged badger
#

Items array doesn't need to be marker as replicated, no

#

the FastArray itself does

#

as with all struct replication - if struct is marked to replicate, all its UPROPERTYs replicate unless marked NotReplicated

timid moss
#

Alright thats good to know then. So the only thing that needs to be marked as replicated is the FFastArraySerilizer?

winged badger
#

yes

timid moss
#

Can you use the rep condition owner only?

winged badger
#

note that if you use OnRep for the array

#

that will fire way after all the per item callbacks

#

you can

#

all normal property replication rules apply for the fastarray

#

the difference is just in how its (de)serialized

timid moss
#

note that if you use OnRep for the array that will fire way after all the per item callbacks
@winged badger Do you mean the OnRep for the FFastArraySerilizer or the actual Items array in the FFastArraySerilizer?

winged badger
#

for the FFastArraySerializer

#

items will do callbacks as they are deserialzied

#

fast array will do it later, after entire property replicates

timid moss
#

nice. this is starting to make sense

steel vault
#

Zlo is good at helping with that

kindred widget
#

So. I did a simple test by painting some foliage actors down, about 2k give or take. Replicated actors with no tick, just a single function that gets ran on the server when the client interacts to 'pick up' the object that adds to an inventory and destroys the actor. I already noticed that this is going to be an unacceptable route because the client takes quite a bit of time before they can receive input updates because of the amount of traffic of the initial replication. So... TLDR, how do you generally handle the initial replication of potentially thousands of actors? My initial thought was creating a foliage manager that has an array of active foliage. Yaw rotation doesn't really matter so I could replicate just a vector array of thousands of vectors on one single actor which is more likely to replicate faster than thousands of actors themselves, right? I could easily build that into a workable foliage placing tool with different settings and even reusability with respawning logic. Or, should I be considering something more like the replication graph?

thin stratus
#

The Array will at some point bite you

#

If you have a lot of actor that need to load then your players will have an initial loading screen i guess

kindred widget
#

So I just did a test with a single actor. Very simple test. Just created 2k vectors on the server into a repnotify array and then on notify event, added instances to an ISM for each vector. What's odd is that the vectors replicate immediately it seems. The meshes all spawn instantly upon client load in the locations they should be in. So this data is already processed and sent, yet it still takes the client ten to twenty seconds before they can move or see the server character moving? I'm a bit lost as to what this bottleneck seems to be, since the vectors are already instantly replicated and done and that's only checked once per second.

kindred widget
#

So, what can cause a client to not be able to move for several seconds? I can't imagine that it's replication causing it since the values are already altered and the player can send RPCs, but it's like they don't receive anything for a short amount of time. Normally I'd assume the network was clogged, but I can't imagine that replicating 500 vectors once and checking that array once per second can cause that much lag?

twilit oak
#

if i want to use RPC functions from a class, does it have to be an AActor and in the level? (GetWorld->SpawnActor...) or is NewObject<...>() ok for this?

thin stratus
#

@kindred widget Well, does it work if you don't replicate the Array?

#

You can also test it to just replicate those vectors without spawning the foliage

#

The Client should not get locked up. If it's bandwidth related you should still see the client trying to move but getting corrected

#

At least I think so

#

@twilit oak Well you need a reference to an instance of that class.

#

NewObject is for UObject based stuff. Everything AActor and lower in the hierarchy should be spawned via SpawnActor and only from the Server if it needs to replicate.

#

Further you can only use Client and Server RPCs if you make sure the Actor is also owned by the Client that wishes to execute the ServerRPC or that you wish to forward the ClientRPC to.
Despite that you can always use MulticastRPCs from the Server to all Clients that have an instance of that Actor replicated.

twilit oak
#

ah, this does get complicated very fast =P what im trying to do is a sound-manager type class that each client has a copy of (does not need to be replicated) but that allso can be used for the server to multicast sound effects etc to all clients. currently trying to make an instance of it in my gamemode, but i have no idea if thats the correct place

thin stratus
#

It has to replicate to allow Multicasts

#

Make it an Actor

#

Spawn it on BeginPlay of your GameState, but filter it with SwitchHasAuthority.

twilit oak
#

AInfo should be sufficient no?

thin stratus
#

Save it into an OnRep variable if you need to bind to anything on the Client or generally need a callback for when it's ready

#

AInfo should also work yeah, but I basically never use it and just make htem Actors and set them up like I want

#

If you work in c++ then SwitchHasAuthority is just if (HasAuthority()) //SpawnActor

twilit oak
#

yep its all in c++

#

thanks for your input!

thin stratus
#

Cheers

kindred widget
#

@thin stratus It's definitely the array. Leaving the Array on Repnotify but disconnecting the spawning still locks up. Can look around with AddControllerYaw/PitchInput but AddMovementInput doesn't even move on the client to get corrected for several seconds. While leaving the array on repnotify, if I either lower the loop count that's adding to the array to like 20, or don't add anything to the array at all, the client can move immediately. But it's odd, because like I said, the vectors are all already replicated. The foliage is spawned the moment the client connects on the notify function. Can look around and see it all in place in the same places it's at on the server. But the Client can't move with AddMovementInput, and cannot see the server move.

thin stratus
#

Either way, big array replication is not a good thing

twilit oak
#

so, am i correct in assuming from what you said that GameMode only exists on the server?

bitter oriole
#

Yes

twin juniper
#

Does anyone know where I might be able to find some tutorials on levelstreaming in multiplayer ? πŸ™‚

meager spade
#

@kindred widget why not use a seed and generate the same array client and server?

#

no replication needed

#

just send clients the seed from the server, let them figure it

peak sentinel
#

using RPCs on tick is not a good way but is there any other way to replicate rotation/movement without tick?

kindred widget
#

@meager spade What about for saving though? If the server saves and I restart, how am I supposed to know which ones not to spawn on the clients?

rich ridge
#

@peak sentinel you don't need to replicate rotation or transform...
Engine automatically replicates your actor

peak sentinel
#

so i just call setrotation? is that easy?

#

have i been trying to solve a problem that engine already does it self for 4 days? lol i need to headbutt the wall πŸ˜„

kindred widget
#

What I'm still at a loss for, is why there is still a huge lag? The vectors are ALREADY REPLICATED. There shouldn't be any traffic. I can look around and see all 2k plants in the same spot on the client as they are on the server. They literally cannot be there unless the vectors are replicated. More over, if I set the actor doing this array replication and holding the ISM component. If I set it's net priority to 0.5 instead of 1.0, the client can move around fine even at 2k vectors being replicated. The client can't see the server moving yet of course, but the client can move their character. I'm confused. The character's NetPriority is 3.0. Why is it even affected by another actor's net priority changing from 1.0 to 0.5?

echo snow
#

Is anyone good with replication here?

peak sentinel
#

@rich ridge well engine doesnt replicate my transform...

meager spade
#

@echo snow cause one is on the player controller, one is in the gamestate, and its always good to use events/functions over just setting properties directly. How about in the future you want additional stuff to happen when something gets updated?

rich ridge
#

@peak sentinel you are doing it wrong...
Just set bReplicates your true in character class

gleaming niche
#

also you aren't checking if it's locally controlled, so it's running both on server and client, but server is the auhoritive one

#

and both are clients

#

so server side is basically always setting nothing, while clients are setting it to their local value

rich ridge
#

Client is not supposed to set it's transform

gleaming niche
#

you can for prediction reasons.

rich ridge
#

Client is simulating on server so server knows

gleaming niche
#

when you use character by default, and control rotation

#

it's setting locally, and on server.

rich ridge
#

Yes right

gleaming niche
#

update instantly on client, set on server to replicate to others.

#

but he's just setting it on tick directly fro mouse, and server doesn't have that info.

rich ridge
#

but he's just setting it on tick directly fro mouse, and server doesn't have that info.
@gleaming niche he should not do that..

gleaming niche
#

so really all he needs to do is make an unreliable RPC, that goes from the client -> server, to update rotation and also update locally

peak sentinel
#

implementing now

rich ridge
#

@peak sentinelhttps://youtu.be/a8ukx6nPub0

An introduction to multiplayer replication in Unreal Engine 4. In this video, learn some basic techniques to effectively produce multiplayer mechanics involving server and client logic. Topics covered: Blueprint scripting, level blueprints, RPCs (Remote Procedure Calls).

LINK...

β–Ά Play video
gleaming niche
#

ie:

if (IsLocallyControlled())
{
  do mouse rotation
  setrotation
  sendRpc_to_server_with_new_rot()
}```
rich ridge
#

@gleaming niche why do this, when engine already handles this

peak sentinel
#

yesterday someone told me to use onrep instead of rpc

#

because ticks not good for rpcs

#

then i changed my whole setup

gleaming niche
#

CMC ticks

#

and sends rpcs

#

lol.

#

the problem is you're doing it backwards

#

you're effectively asking the server to read it's mouse cursor

#

and replicate the value to clients

#

well server doesn't have your mouse, does it?

peak sentinel
#

of course doesnt have

gleaming niche
#

so you need to tell the server.

#

and then it can replicate to others.

#

just like you do with movement inputs, and weapon inputs

peak sentinel
#

i understand, but about another scenario, isnt it about just value?

rich ridge
#

@gleaming niche I still don't understand why you write additional logic inside character class to replicate it's movement , when engine already does it

peak sentinel
#

server doesnt know my mouse, but there is a mouseloc variable

gleaming niche
#

@rich ridge he's trying to make it rotate to where the mouse cursor is on screen

#

which that stuff there is also wrong, but that's another issue

peak sentinel
#

lol

#

there is nothing true when it comes to rpcs

rich ridge
#

Ohh now I understand

peak sentinel
#

is there any other valid method to rotate to cursor? whats wrong

rich ridge
#

I can suggest you one optimal solution, inside your mouse input function, you calculate delta and then do RPC...

gleaming niche
#

well in order to actually look at the mouse cursor, you would do that hit result, and then you calculate the direction from the player, to the result

#

and then covert that to a rotation

peak sentinel
#

then lerp, i guess?

#

i saw tons of lerp on forums while rpcs rotation

#

I can suggest you one optimal solution, inside your mouse input function, you calculate delta and then do RPC...
i will try this

gleaming niche
peak sentinel
gleaming niche
#

could be simplified a bit, and just take the rotation directly and then just write yaw. like

SetActorRotation(FRotationMatrix::MakeFromX(End -Start).ToQuat()); //use the Quaternion version, and just set it; assumes pitch and roll will match.
SendRotation(GetActorRotation().Yaw);```
#

since above i match the hit location Z to the actors Z, so it will be flat.

#

whether the cursor is on a pillar or in a hole.

halcyon totem
#

i am working on a vr/pc hybrid

#

where would the code go so that I can have the player choose VR or PC?

peak sentinel
#

@gleaming niche i was about to give up until you helped

#

thanks a lot

#

works 10/11

#

may god help you with your fps projects πŸ˜„ lol

raven anvil
#

I have a multiplayer game (listen server) with a scoreboard on the HUD that should provide an updated score whenever a player registers a kill. There's logic in my GameMode (i.e. server only) to process the death and call SetScore on the PlayerState (included function to the PlayerState base class). In the PlayerState OnRep_Score, I call GetPlayerController(0) and update the HUD with the new score. The Score variable is (internally) set to replicate with COND_NONE and REPNOTIFY_OnChanged.

With a listen server, only the clients get the updated score, and the server itself never triggers the OnRep function. Is there another way of doing this? I'm thinking of calling the update HUD method directly from GameMode but that seems a little messy.

echo snow
#

@meager spade thanks for the help

kindred widget
#

So, I finally solved the initial few seconds of lag issue I was having earlier from replicating 2,000 structs(two uint8s). I did not realize that the default engine limit on bandwidth is 10,000b/s. However, I'm still rather confused by the phenomenon. What data is being transferred over the network AFTER the array replicates? Like I said before, the client already had those 2k struct and used them for it's setup. I could move around on the client and see all of them just fine, but any other traffic from the server was ignored for seconds leading me to believe that it's download limit was capped. So is there some sort of other download traffic that follows array replication? Something like a data check, or something like that?

lilac bear
#

hey guys, quick question. What is the proper method for PlayerController to query the level for info? such as spawn points or other actors?

meager spade
#

what you mean proper?

#

you either have a manager actor in your level that all spawn points register to, or use GetAllActorsOfClass