#multiplayer

1 messages · Page 393 of 1

sharp spire
#

@Takain#1607 Gamelift does that I believe

#

@Boowman#9463 you have a server event to change the replicated variable

#

But make sure it’s running on owning client only

#

There’s a drop down I think it’s replicated condition

#

Also does anyone know if toggling on “OBB data inside of apk” or however it’s worded is the method to go for testing?

sharp pagoda
#

OOB data?

tawny parcel
#

Anyone know why abslog would not work right when uploaded to a host provider?

unreal isle
#

Hi! Does anybody know if the physics replication implements dead reckoning or another similar algorithm? Or just set the physics variables on the OnRep? Thanks 😃

worn nymph
#

anyone know a performant way of checking distance between 1 actor and multiple actors at once . was thinking do a sphere trace with the radius being the max distance i want to check and then anything hit by the trace would be in range? but not sure if that is the best way

viral raft
#

Someone who knows why client to server replication doesnt work here

wary wyvern
#

Guys, is it possible to make RPC functions work in UObjects?

viral raft
#

Idk

#

Works in blueprints @wary wyvern

wary wyvern
#

@viral raft It doesn't for me.. CPP or BP(

winged badger
#

its possible, but requires extra work

wary wyvern
#

@winged badger That's not what I need. It's about replicating UOBjects. But I need to call RPC events from client to server and use Multicast..

winged badger
#

if you want to do it from an UObject and it is not supported for networking, and/or doesn't have a replicated actor owner, it will not work

wary wyvern
#

@winged badger Got it working. Yes, UOBjects are not supported. But you can replicate events by overriding CallRemoteFunction() and GetFunctionCallspace()

#

I'm not able to find info in docs, had to check sources and simply copy logic from ActorComponent..

#
bool USpecialAction::CallRemoteFunction(UFunction * Function, void * Parms, FOutParmRec * OutParms, FFrame * Stack)
{
    AActor* Owner = Cast<AActor>(GetOuter());
    if (!Owner) return false;
    UNetDriver* NetDriver = Owner->GetNetDriver();
    if (!NetDriver) return false;

    NetDriver->ProcessRemoteFunction(Owner, Function, Parms, OutParms, Stack, this);

    return true;
}

int32 USpecialAction::GetFunctionCallspace(UFunction * Function, void * Parameters, FFrame * Stack)
{
    AActor* Owner = Cast<AActor>(GetOuter());
    return (Owner ? Owner->GetFunctionCallspace(Function, Parameters, Stack) : FunctionCallspace::Local);
}
#

Should add this to the docs someday )

fleet sluice
#

@wary wyvern I'm very interested in this. Would you be willing to make and share an example, please?

#

I also think I'm not the only one. This sounds like a much cleaner solution than replicating UObjects

winged badger
#

if you need just the RPCs and don't need properties it is, by far

wary wyvern
#

@fleet sluice In order to make RPC functions work, your UOBject should be replicated by AActor or AActorComponent.

#

This code simply makes RPC works inside UObjects.

fleet sluice
#

Aha, I thought you had found a way around replication, for a moment.

#

Thanks anyway!

winged badger
#

it is still much cleaner, because you don't have to override ReplicateSubobjects in the Actor

wary wyvern
#

@winged badger You do have

#

@winged badger Again, these functions ONLY to make RPC events work

winged badger
#

nod

hidden thorn
#

I have a question, is there a reason why the Z is not being updated on the server on the MoveItemLocation object?
https://i.imgur.com/Mxrsyok.png
I am printing the Location of the object in tick like this

if (Role == ROLE_Authority)
    UE_LOG(LogTemp, Warning, TEXT("Location [%s]"), *GetHoldItemLocation()->GetComponentLocation().ToString());

And X and Y are being updated as I am looking around but not Z

meager spade
#

how would i implement a loading screen ?

#

i create the widget, but it never shows

hidden thorn
#

Well just before you switch to another level create the widget and add it to viewport, if you want an animated loading screen you need to use Level Streaming

meager spade
#

i do that

#

its when i load the level through server travel

#

it never shows loading screen

tawny parcel
#

@meager spade You need the server to tell clients to create the widget, than shortly after fire the level change

meager spade
#

makes sense, i will try it

tawny parcel
#

Than when all is loaded, remove the widget

#

Which can also be a server call on detecting when everyone is loaded to the new level, if you want to make sure no one moves around until everyone is loaded

twin juniper
#

Is there only one GameState per session?

#

I'm asking because I'm storing all player controllers on it as they join

#

like zo

#

the server sees itself and the client

#

but the client only sees itself

#

client:

#

huh. weird

#

for both the server and the client the length of "PlayerControllers" is 2

#

the plot thickens

#

apparently, it fails on casting to the custom player controller

#

when it casts to the client's PC (itself), it works

#

but it fails when it casts to the server's PC

#

🤔

meager spade
#

have you printed out the value

#

i would put a print string on the fail node, and get a debug report

twin juniper
#

which value?

meager spade
#

array element

twin juniper
#

I've printed the length

#

but yeah, lemme do that

meager spade
#

drag that node to the string node on a print string

#

see what controller is being set

twin juniper
#

good call

#

so one is presumably "null"

#

because the length is 2

#

but only one name gets printed

#

server side:

meager spade
#

did you print that on the fail node?

twin juniper
#

I printed it right after the loop, with the controller name

meager spade
#

ah okay

#

is the client player controller being helped along (ie kept up to date with the players controller) as they are both seperate, client has a copy (iirc) of the players controller

#

server has a copy*

twin juniper
#

well, they're stored in the GameState, to which everyone has access

#

if that's what you're asking

meager spade
#

i think you should be sending a RPC to the server, and getting the server to create the widget on the clients

#

unless that is what you are doing?

twin juniper
#

no, I'm just accessing the PlayerControllers array on the GameState

#

but yeah, I could try that

#

but is it good practice to get the server to create the widgets for the clients?

meager spade
#

not sure tbh, not created a ingame ui yet, but it is upcoming

sharp pagoda
#

No, when you hit, for example, the tab key, you want your scoreboard to show up instantly, not wait for the RTT to have it come up on your screen. What @twin juniper is doing seems correct, I'm puzzled as to why it's null

meager spade
#

is it null on the server or the client?

sharp pagoda
#

The server controller is null on the client instance, right?

#

Can you try 3 players and see if the two clients can see each other? @twin juniper

twin juniper
#

okay, lemme try

#

well, this is interesting

#

each client sees itself

#

the server sees all 3

#

should I try to make the variable a PC_Gameplay array and cast to PC_Gameplay OnPostLogin, then add them there?

meager spade
#

i think you need to use PlayerStates

#

clients can only see the own controller, but can see others PlayerStates maybe?

#

reads up

twin juniper
#

well, they're added by the server to the PC array in the GameState, which is replicated

#

In c++, using the typical example of NetSerialize function, how would one serialize a bool?

#

by my logic, they should be readily available to everyone

sharp pagoda
#

The game state is replicated down to all the clients, so this should work. Maybe it's security related? Try replicating the names of the clients or something

meager spade
#

i think it is security related, but you can access other players PlayerState

twin juniper
#

trying it now

meager spade
#

i would get all playerstates and interate through them

#

and see if you can pull a value from them

#

iterate*

twin juniper
#

I still need player controllers for the player states

#

yeah, names replicate correctly

#

both show up on the client

sharp pagoda
#

Ah hah

twin juniper
#

left side

sharp pagoda
#

It is security related

#

So you're going to need to just send over the data you need

twin juniper
#

darn it

sharp pagoda
#

Kind of makes sense, you'd really be able to mess with other people if you have full access to their PC

meager spade
#

doesn't GameState store the playerstates?

sharp pagoda
#

What do you need the entire PC for though?

twin juniper
#

in my mind, everything in the GameState should be one-way

#

according to this handy-dandy chart

#

😄

#

@sharp pagoda I'm using to keep track of what players I have

#

add them as they connect, remove them as they disconnect

sharp pagoda
#

Well then you just need a name and maybe a ping right?

twin juniper
#

hmm

#

I was using them for posession purposes

#

but I don't need that in the GameState

sharp pagoda
#

Ah, yea you can't possess like that

twin juniper
#

I can just as well have them in the GameMode

sharp pagoda
#

Making other players possess something from your end as a client just sounds like a really bad idea

twin juniper
#

no, as the server

#

all the posession takes place in the GM

#

but I was trying to hit two birds with one stone, to have all the PCs in one place, along with their info

#

but yeah

#

you've been extremely helpful guys

#

thank you!

sharp pagoda
#

👍

icy nacelle
#

Do I need to run on server if I'm changing movement mode on a character?

sharp pagoda
#

Yes, it is gameplay critical

icy nacelle
#

Thanks 😃

wary willow
#

hm

#

@icy nacelle What do you mean Movement Mode on Character tho?

icy nacelle
#

@wary willow 'SetMovementMode' node. For walking/flying/falling/swimming etc

gloomy tiger
#

@fluid mica @turbid heron continuing the discussion from #umg

#

according to the docs, I shouldn't use seamless travel

#

because the map wasn't loaded the first time

turbid heron
#

if you mean when the game first loads up

#

?

gloomy tiger
#

quite haven't understood the question

turbid heron
#

you an use seamless travel going from map to map

gloomy tiger
#

basically the players opens the game and goes to the start menu

#

from there, they are able to find a match. when the match is found, they connect to the server

sharp pagoda
#

Don't use seamless travel on initial game load

gloomy tiger
#

what initial game load means @sharp pagoda ?

sharp pagoda
#

Loading up the application for the first time. You use seamless travel when you want to switch maps, for example

turbid heron
#

yeah he means from the titlescreen level to whatever level

#

you can use seamless there

meager spade
#

wouldn't loading the game load a deafult map anyway?

gloomy tiger
#

switching to a map that wasn't loaded before counts as well? @sharp pagoda

meager spade
#

so you can seamless travel from that to anymap

turbid heron
#

your default map should be the start menu

gloomy tiger
#

yes, start menu is the default map for clients

meager spade
#

i seamless travel from MainMenuMap to my lobby map

sharp pagoda
#

@gloomy tiger Yes, for example, you just finished a game of TDM and want to change maps. You would use seamless travel to load in that new map you're about to play

gloomy tiger
#

hm

#

maybe Epic's docs are wrong?

#
There are three ways in which a non-seamless travel must occur:

When loading a map for the first time
sharp pagoda
#

No that's correct

gloomy tiger
#

if it's the very first time the player is playing that day

meager spade
#

but you wouldn't seamless travel from a gamemap back to the main menu for example

gloomy tiger
#

the map they will be playing wasn't loaded previously

meager spade
#

@gloomy tiger a map, it doesn't say the game map

#

the first map they load is the MainMenuMap

#

which is not seamless

gloomy tiger
#

what confused me was the usage of the a before map.

#

but now it's clearer

#

though what epic is stating is correct, between us, kinda confusnig right?

turbid heron
#

epic's features are confusing?

#

wow never experienced this before

gloomy tiger
#

lol

twin juniper
#

In c++, using the typical example of NetSerialize function, how would one serialize a bool?

#

I'm having some trouble wrapping my head around a problem with killing players

#

I know which player died

#

but I'm trying to figure out who killed him

#

Damage Instigator just gets the last actor that dealt the damage

#

huh, I guess I could use that lol

twin juniper
#

yeah, that worked

tawny raven
#

Tell me you secrets @twin juniper

sharp pagoda
#

@twin juniper Either use the last instigator, or track who damages you over time with how much damage they did, and declare the person who did the most damage as your killer

twin juniper
#

@sharp pagoda that's the plan, for now, I just get the last instigator

summer nova
#

@twin juniper that is literally what instigator is for lmao

#

its a relic on unreal from the unreal tournament days

flat bison
#

Is there any good info on getting player controller info on a dedi. As in this contoller picked this class and the other one choose a class also to spawn into a level

#

if that makes sense

hasty adder
#

Well you could say have an enumeration if classes variable in your pc class or better yet maybe ps. Forget which is in the event override choosedefaultclass

#

Which you can then work some magic

flat bison
#

well, i am trying to determin who is who player controller wise, when i load in 2 clients without Dedi checked client 1 can choose and spawn while player two cannot, and when loaded with Dedi checked neither can select

#

tbh this is prob something simple i am over thinking

meager spade
#

rror C2360: initialization of 'SearchResults' is skipped by 'case' label

#

thats for the failed, notstarted and default labels

#

nvm, fixed 😄

#

and wrong chat aswell :/

hidden thorn
#

How come the first snippet works but the second one doesn't??

void ARPGPlayerController::SetPawn(APawn* Pawn)
{
    Super::SetPawn(Pawn);

    if (Pawn)
    {
        if (HasAuthority())
            this->ClientEnableNetworkVoice(true);
    }
}
// PlayerTalking is called on a key press
void ARPGPlayer::PlayerTalking()
{
    bImTalking = !bImTalking;

    Server_PlayerTalking(GetWorld()->GetFirstPlayerController(), bImTalking);
}

void ARPGPlayer::Server_PlayerTalking_Implementation(APlayerController* PController, bool bIsTalking)
{
    UE_LOG(LogTemp, Warning, TEXT("PController Name: %s - Player"), *PController->GetName()); // <- On the server I am getting the right controller name

    PController->ClientEnableNetworkVoice(bIsTalking);
}
bool ARPGPlayer::Server_PlayerTalking_Validate(APlayerController* PController, bool bIsTalking) { return true; }
verbal wave
#

Should I do this? MCharacter is replicated, exposed on spawn and set by server (on spawn). Client needs to wait for the replicated value.
I found this is the most convenient way to do it wihout setting up additional initialize function. Feels dirty af though.

fossil spoke
#

Make it OnRep?

#

@verbal wave

verbal wave
#

@fossil spoke Setting parameters on spawn doesn't trigger OnRep on server. Setting them after spawn does, weirdly enough

#

I can treat them differently. But I'm OCDing on this.. What do you do usually?

fossil spoke
#

Well it would depend on what it is exactly your trying to do, i probably would try and find an means to avoid an issue like this.

#

Where your waiting for an Replicated variable on spawn.

#

Why are you Replicating an reference to an Character anyway?

#

@verbal wave

verbal wave
#

@fossil spoke e.g. when the character spawns a drone, the control is transfered to the drone(fly up, turn etc.).
There is a rope connecting the two, so character is basically drone surfing on grass.
Additionally, this drone might be taken by other characters. That's why I want it to work with Replicated character reference, instead of using Eject / Attach functions

#

the drone is not a pawn because characters are still possessed while surfing. Can shoot etc.

#

Iirc OnRep is how APlayerController & APawn possess works for all clients

#

This reminds me that there are actually a lot of code in APlayerController to seperately deal with server possess, client OnRep possess, dirty local client set replicated variable operations because 'people assume the references should always work two-way' etc.

So I probably want to do that 😃

plain flume
#

Anybody managed to create a voice chat without using the steam as middleware?

#

Is there any build-in solution or is everything needed to built from scratch

spiral badge
#

Sorry for beginner question.
Did anyone know a good tutorial series for an Multiplayer FPS?

sterile pebble
#

hm, sorry, that was a paid one.

spiral badge
#

It cover all?

#

Team ui etc

#

?

#

How can buy it?

#

#meepmeep

viral raft
#

Why the hack isnt this replicatting from client to server and other clients

#

Grr

meager spade
#

1 your packaging failed 😄

#

but your pucture is kinda small

#

nvm it wouldnt load the big one but it did now

#

you got your calls mixed up

#

you should be calling it on the server from the client

#

and then the server just does a multicast

#

and if you are the server, play it yourself

viral raft
#

@meager spade how do you mean

#

I call the server and he does a multicast

#

And on remote I call the client

meager spade
#

your multicast call is getting called from the server, you don't need to call it again on the client

viral raft
#

Ah okay

meager spade
#

let me show you example quickly

viral raft
#

Could you send a example? That's easier to understand :D

#

Ah thx

#

You were faster haha

meager spade
#

wait forgot to setup the replication

#

@viral raft

viral raft
#

Thxx @meager spade

#

@meager spade So in serversendtoallclients I need to put play and reverse?

meager spade
#

no, DoThisOnAllClients

#

is where you run anything you need to all clients

viral raft
#

Ah okay!

meager spade
#

i am trying to get lobbies working, so players join, and then they have to ready up once all of them are ready, we launch the game 😄

#

thing i am trying to work out how to handle is having friends connect before we launch/find a session

flat bison
#

So i am trying to test let each client that connects the Dedi then click a button a spawn as a different class(hero) but when run on the Dedi it does not let either client chose a hero it sends it all the way to isvalid? and comes back as false. when not run on a Dedi it works for only 1 client the original client

#

am i going about this wrong?

winged badger
#

if its a server event it always has authority, that switch is redundant

#

if the idea is to select the class locally

#

the only way to let server know which one is selected is to push it as an input on a server RPC

#

when you call SetPlayerControllerAndClass you are pulling the value of variable Class from server

#

and i imagine it was never set there

flat bison
#

What would be causing the player controller issue?

#

I think that's where I feel i am lacking info

winged badger
#

add an input to SelectHero RPC

#

that takes the variable Class in

#

and then connect that to SerPlayerControllerAndClass

#

you might also wish to set the variable itself on the server from there

flat bison
#

Am I grabbijg the player controller correctly I feel as if I am making assumptions there

winged badger
#

any user input happens on client

#

so if you have a UI that lets the player select his class

#

then clicks a button to confirm which calls that ServerSelectHero

#

server has no idea what class was selected

#

unless you send it along as an argument to SelectHero RPC

flat bison
#

ok

#

the whole "get player controller" on multiplayer still gets to me

winged badger
#

server creates the playercontroller

#

and replicates it to the client

flat bison
#

so when i am running "self" it should pull the correct controller?

winged badger
#

if you are running a server RPC inside of it

#

you don't need to send a reference to it at all

#

as it automatically executes on server copy of the PC

flat bison
#

ok ill run tests on what you said 😄

#

@winged badger ya wouldn't know of any great spots for info of interactions between player controller and game mode of dedi are

#

I Did a few hours googling yesterday and did not come up with much

winged badger
#

check pinned resources on this channel

#

read cedric's compendium if you haven't already

meager spade
#

how would i implement like a way to invite friends into a game, before we search for a game?

#

more of the what would i need to do rather than how to do it. would i create a session locally and then send both of them clients to a session globally?

winged badger
#

what OSS?

meager spade
#

a bit like how fortnite handle it where you can join each other before you find a game

#

Steam

winged badger
#

lobby?

meager spade
#

yeah, but like its the menu aswell

winged badger
#

i mean Steam Lobby

#

you don't need to create a session for it

#

it exists on steam servers

meager spade
#

oh

winged badger
#

gives you chat + some ability to share data / set flags

meager spade
#

cause i am using sessions for games over steam when traveling from menu to map

#

i basically ripped out most of the ShooterGame stuff and implemented it in

#

and removed all the slate stuff

#

oh so the lobby is seperate to the actual game session

#

is reading up on it

#

is that what i would use?

toxic pawn
#

Hey guys, a noob here with a multiplayer related question.

#

I have a custom variable added on the thirdpersoncharacter blueprint that comes with the thirdperson template, and on the server it does get set properly at first, but the very next tick it's null

icy nacelle
#

@toxic pawn Try posting screenshots, its pretty hard to see where you're going wrong when we've got nothing to see 😃

toxic pawn
icy nacelle
#

Okay so a few things:
Firstly, whys the camera so close to the players head? This may cause errors. If you want it to be a first person multiplayer game, it'll be easier just to hide the character JUST for the player's client.
Secondly, this doesn't tell us a whole lot about where you're going wrong, could you post the blueprints that are related to this?
I have a pretty good idea at where you're going wrong, you're trying to access the variable from the server, when its saved on the client and NOT the server. If you post your blueprint I'll be able to tell you where you're going wrong on that one

#

Your calculation direction function would be useful to see

toxic pawn
#

Sure, sorry for that. I need to have the camera on the player because I have a turn head function that allows you to see your own body as if you'd be turning your head, and it works pretty nice I dare say (in single player, at least).

#

Do you only need the function where I access it or where I set it too?

icy nacelle
#

I'd still look at hiding the head for the player.
I'm going to need to see more than that to help you.

#

Both functions yeah

toxic pawn
#

Ok

#

So that above was the part that was effectively throwing the error

#

Now I'm posting where I set the variable

#

The execution is connected to the begin play event

#

Any ideas @icy nacelle ?

icy nacelle
#

Going to have to see more than that to help you

#

Bunch it all together and post a screenshot of the entire event

toxic pawn
#

You mean all that is connected to event begin play?

icy nacelle
#

and also where you're trying to get the variable from

#

So this bit above is being used after being play on third person character?

toxic pawn
#

Yes

icy nacelle
#

Okay, the problem isnt here, its where you're trying to get the variable from then

toxic pawn
#

You mean in the calculate speed function?

icy nacelle
#

Yeah

toxic pawn
#

Ok, I'm sending you the whole thing, piece by piece

icy nacelle
#

Try putting an isvalid node before the function too

toxic pawn
#

Sorry for the last being too small, but they are just math related things that have nothing to do with that variable

#

@icy nacelle

icy nacelle
#

Okay so I'll try and explain the problem to you so you can understand it better

#

On begin play, you're getting the characters animation instance and setting this to a variable (so you can use it later).
When you call "Calculate speed by direction", you're using it for the function "Calculate Direction", but the game cant find anything on this variable.

#

Are you calling calculate speed by direction on the server?

toxic pawn
#

Sorry, but as I said, I'm very much a noob to Unreal and even more so when it comes to networking. How would I go about calling it on the server? Also, I read some networking documentation about replication and calling events on server/client but I don't understand much of it.

icy nacelle
#

Thats cool man, we're all noobs when we first start.
To be honest, I'm not entirely sure why you need the animation instance to calculate the direction...
The best thing to do is to read Cedriks compendium:
http://cedric-neukirchen.net/2017/02/14/multiplayer-network-compendium/

I'd also check out this too:
https://www.unrealengine.com/en-US/blog/blueprint-networking-tutorials

Unreal Engine

A previous blog post offered a crash course in blueprint networking, but now we’re back with a thrilling six-part mini-series on creating blueprint content that works in a networked game!

toxic pawn
#

Thank you, I hope that'll help!

icy nacelle
#

LOOKING FOR ADVICE:

I'm currently looking at replicating my weapon/tool prototypes to make them work in multiplayer.
I've got a tool which has functionality to change its scale whilst being used. Should I make the actor run everything on the server?

hidden thorn
#

For some reason if I set the character to have GetMesh()->SetAllBodiesSimulatePhysics(true); and then I set it back to false the Mesh is not attached to the RootComponent anymore, is there a reason for that?

unique thunder
#

If I did this in a multiplayer setting, would it only cast locally to the player, thus allowing me to run this kind of logic on all machines separately to cast to their own players?

sweet spire
#

yes

fallen oracle
#

first player is always the local player, so its ok. even on client

plain flume
#

@toxic pawn If some replicated variable is connected to BeginPlay() then it might be empty for the client because it havent got time to get value from server.

#

For example, If I want to get data from PlayerState in BeginPlay() I would use a timer that checks if the values has been got from server. When everything is ok, I disable the timer and continue code

tribal sail
#

So I have a map and I want to walk around it with my friend. What's the simplest way to do this?

gleaming vector
tribal sail
#

Alright let me rephrase it.
What are the minimum requirements to enable someone to connect to the same game as me? What coding/blueprints do I have to do to handle that?

thin stratus
#

@tribal sail over the internet, via IP I assume

#

Most straight forward way is to add a key to the console

#

In your input settings at the bottom

#

One user types "open MapName?listen"

tribal sail
#

do you know what port I have to use to port forward?

thin stratus
#

The other one "open PublicIP"

#

7777 usually

tribal sail
#

they type it where?

thin stratus
#

You can open the ingame console in development packages games or editor by adding an input to your input settings

tribal sail
#

is it different for packaged projects?

thin stratus
#

If you want it via UMG, you would need to create a widget with a textbox and use the "execute console command" node

#

Shipping projects don't have the console afaik

#

Development builds still do though

tribal sail
#

in shipping projects, can UMG execute the console?

thin stratus
#

Yes the node keeps working

#

Just the console doesn't open via key anymore

tribal sail
#

so I start a server, which I still have to look up, then start a client, then do that, and it'll connect?

thin stratus
#

If the Server is started and the port is open, yes

tribal sail
#

I thought there was c++ or blueprint logic that needed to be involved

thin stratus
#

Do you want a dedicated server or should a player be the host?

tribal sail
#

dedicated sounds easier for right now

#

thank you, sir. you are a gentleman and a scholar

thin stratus
#

It's actually the opposite

tribal sail
#

oh really?

thin stratus
#

For dedis you need the source code from github

#

And build the engine

#

Epic Games Launcher engines can't build dedi servers

tribal sail
#

well I do have the source code but the project i'm using comes from a launcher version

thin stratus
#

Well you can change that by rightclicking the uproject file

tribal sail
#

yeah good point. I'll do listen server for now

thin stratus
#

Alright. Just keep in mind a ListenServer needs to open a map with listen command

#

You can use a simple UMG button that calls "OpenLevel" node

#

And put "listen" as on option

#

Or also via the console command node like i wrote earlier

tribal sail
#

so it's the same command to open the level but you have to have the listen option enabled?

thin stratus
#

Yeah so it listens for incoming connections

tribal sail
#

gotcha

thin stratus
#

Check the pinned document that I wrote

#

There should be some infos at the end

#

@plain flume Why not using a combination of RepNotify, boolean and EventDispatcher? Set the boolean to true and call the event dispatcher in the onrep of your data. And whereever you need the data, you check if the boolean is true. If it's false you bind to the dispatcher and wait.

#

That should remove the need of looping a timer

#

In cpp you can even let multiple variables use the same repnotify function

tribal sail
#

when I use the Execute Console Command node, it's asking for a player controller. Will the client default to 0?

sharp spire
#

im having issues destroying an actor a UI is attached when clicking the UI button.. seems like it should be simple but somehow its not.. its working for the server, but wont run for the clients at all,

#

And I tried destroying the actor through an rpc and it did no justice .-.

fossil spoke
#

Post your code mate.

sharp spire
#

Sorry, I will in just a moment I stepped out for some air haha it’s quite literal though. I’ll post it in just a moment

sharp spire
#

booting up now

#

this is where it all begins

#

the last node is useless but i was testing to see if maybe it wasnt being transferred lol

#

here is the onclick

#

it adds the item just fine, but does not destroy the actor

#

also its just clients that cannot destroy the actor, but the server can just fine.. lol

#

okay so somethings up..

#

whats that mean? lol the actor is set to replicate..

fossil spoke
#

So you know that if you Spawn or Destroy an Actor ServerSide it will also do that on each Client if the Actor is set to Replicate

#

You should need to have the OwningItem variable Replicated.

sharp spire
#

yes but even creating a server ran event in my droppeditem actor which is set to replicate wouldnt give the same result

fossil spoke
#

The other thing is that UI exists Client side only.

#

They also cannot Replicate

#

So you need to route any RPCs through an supporting class

sharp spire
#

the actor that owns the ui has the server ran event :\

fossil spoke
#

Like the Controller

#

Does the Actor have an NetOwningConnection?

#

As in its Owner Heirarchy returns to an Controller?

sharp spire
#

that makes sense

#

its going to be a pain to always reference a controller to destroy something.. lol

#

but ill work with what im given

fossil spoke
#

Well your UI has access to an Controller, the Server has access to All Controllers.

#

Button -> Controller RPC to Server -> Server Calls Destroy on Actor

#

As long as the Actor is Replicating it will also be destroyed on all Clients

sharp spire
#

thats what im doing now, i just thought maybe it could handle itself lol

#

but needing a controller makes sense for the most aprt

#

part*

raven holly
#

Anyone got seamless travelling to work?

#

Like having those 3 dots on the bottom right come up

#

I assume that means seamless

meager spade
#

i use seamless travel in my game

#

works fine

raven holly
#

So when you connect to a server the dots come up?

#

What commands do you use to travel

meager spade
#

i don't think i see the dots on mine

raven holly
#

Ok

#

I have a dedicated server which when the client connects to their client freezes

meager spade
#

PlayerController->ClientTravel(URL, TRAVEL_Absolute);

raven holly
#

URL = IP ?

meager spade
#

no

raven holly
#

hmm

meager spade
#

url is the travel url

raven holly
#

whats the travel url

#

Are you using dedicated servers?

meager spade
#

not at the moment but it uses sessions just the same i think?

raven holly
#

i dont use sessions

meager spade
#

how you connecting

raven holly
#

open IP

meager spade
#

right but how are you seamless travelling

#

what you passing along

raven holly
#

Well nothing I was just figuring out if seamless travel will async load the server map

#

instead of freezing the client

#

until the maps loaded

meager spade
#

does it load after the freeze?

raven holly
#

yeah ofc

meager spade
#

mine freezes when travelling

raven holly
#

oh

#

i wanted to have an animated loading screen

meager spade
#

i would put a loading screen

raven holly
#

but it just freezes lol

#

yeah i have a loading screen

fossil spoke
#

Is it using UMG?

raven holly
#

what is?

fossil spoke
#

Your LoadingScreen

raven holly
#

yes

#

but the whole client freezes when I open <ip>

#

until it loads

fossil spoke
#

I use an Slate LoadingScreen when connecting to an Server, plays an video fine, no noticable freeze.

raven holly
#

ah it does?

fossil spoke
#

Yeah works perfectly

meager spade
#

is your slate loading screen a module like how shootergame does it?

fossil spoke
#
FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &UFDGameInstance::BeginLoadingScreen);
FCoreUObjectDelegates::PostLoadMapWithWorld.AddUObject(this, &UFDGameInstance::EndLoadingScreen);
#

Hook into those 2 delegates

#

BeginLoadingScreen handles generating the screen based on some predefined values for each level (ie what video to play for what map) and EndLoadingScreen just fades from black to make it look cool and cleans up the Slate widget

#

No its not its own module.

meager spade
#

ah okay i will try that aswell, i need a loading screen

raven holly
#

Interesting

fossil spoke
#
void UFDGameInstance::BeginLoadingScreen(const FString& LevelName)
{
    FString ActualLevelName = *LevelName;
    TArray<FString> ParsedName;
    ActualLevelName.ParseIntoArray(ParsedName, TEXT("/"), false);
    ActualLevelName = ParsedName[ParsedName.Num() - 1];

    FREEDOME_LOG(" ---- Started LoadingScreen for %s at %s ----", *ActualLevelName, *LevelName);

    if (bHasLandedOnMainMenuLevel)
    {
        GetMoviePlayer()->SetupLoadingScreen(LoadingScreenManager->BuildLoadingScreen(ActualLevelName));
        GetMoviePlayer()->PlayMovie();
    }
}
raven holly
#

i see

fossil spoke
#

SetupLoadingScreen prefills values for the movie player and then starts the movie

#

BuildLoadingScreen is what creates the actual Slate widget

raven holly
#

ok cheers

fossil spoke
#

This is the really simple Slate widget code

#

Some naughties in there though lol

#

Was written ages and ages ago 😃

meager spade
#

@fossil spoke how do you end the loading screen? just destroy the widget?

fossil spoke
#

GetMoviePlayer()SetuploadingScreen() handles it.

#

MoviePlayer.h
/** Passes in a slate loading screen UI, movie paths, and any additional data. */ virtual void SetupLoadingScreen(const FLoadingScreenAttributes& InLoadingScreenAttributes) = 0;

meager spade
#

ah bAutoCompleteWhenLoadingCompletes

meager spade
#

nice loading screen works awesome 😄

#

i just made a simple slate with a image

#

didn't need it to be animated

fossil spoke
#

Having it play an video makes it extra cool i guess.

meager spade
#

yeah but i have no videos, but if i ever need to its quite easy to implement

fossil spoke
#

Yeah.

#

Just keep in mind that for some reason UE4 and videos are weird.

#

They wont play at "normal" resolutions

meager spade
#

oh

fossil spoke
#

1920x1080 for example

#

Has to be 1920x1088

#

for some weird reason

meager spade
#

that is odd

fossil spoke
#

I wonder if @outer birch can enlighten us?

tribal sail
#

I have two instances of my packaged project running, one has a level loaded with "listen", but the other one can't join with the "open IP" command. I have the port 777 opened up on my router. Is that the only one that needs to be opened?

glacial pollen
#

@tribal sail Get the free "AdvancedSessions" plugin and never look back

winter harness
#

Has anyone had luck with getting Gamelift working with their UE4 project and Linux Dedicated servers? If you have and are willing to chat about it ive about run out of candle to burn at both ends on this.

thin stratus
#

Only got the windows dedi to work with that. No idea if I can be of help

#

@glacial pollen @tribal sail the AdvancedSessionPlugin wouldn't help him at all. He wants direct IP connection for now over internet. Sessions would still require steam to be setup so he can actually find online sessions

fluid mica
#

@tribal sail it's 7777 for Unreal and 27015 for Steam, if you're using steam.

#

That said I'm fighting since weeks to get my dedicated server running, which required me to change my modem and I'm still having problems with my provider because I just have an IPv6 and my IPv4 gets tunneled.

#

I was supposed to get my own public IPv4 on Friday and nothing has happened yet. This will be my tenth call if I don't count the ones I didn't go through cause of 20 minutes waiting in line. It's a real pain the ass and I hope it's not the same problem for you.

faint fable
#

Hi, I have been developing a MP game and have had working 4 player matches peer to peer before. (4.16) I'm now running 4.18.2 and my multiplayer works fine when 2 people are connected to each other. However when there is more then 2 people on the server the 3d (or 2d client) can't do anthing. Not respawn. or tell the server to run any event "run on server". Anyone else experianced this ? been at this F..ing problem for 4 weeks

#

The code has been more or less the same, from all that i learned the past few years tells me the code is correct. (it's clearly working when there is only 1 client). This sh it is destroying me on a molecular level

subtle peak
#

Hey guys, my blueprint does not replicate from the client through the server even though i am running it through a "run on server" event. It works fine when the server fires the event.

subtle peak
#

Any help would be appreciated!

brittle sinew
#

Do you see anything like "no owning connection" in your log?

#

If so, that means you're trying to call a server RPC on an unowned actor.

#

In order to call a server RPC on an actor, it needs to be owned, either directly or indirectly, by your PlayerController.

#

(they can also be called on the PlayerController itself)

upbeat raven
#

Hey, does know how to get multiple screens not to appear on top of each other when playing a game in multiplayer? I've fiddled around with the settings quite a bit and can't quite figure it out. Would make debugging much easier if I could get them to spawn in different positions

viral raft
#

I only see remote print on client

meager spade
#

let me setup a quick test

viral raft
#

Okau :)

meager spade
#

this works fine for me

#

wait..

#

hold on

#

yeah thats right

viral raft
#

@KaosSpectrum#0889 Nope

#

@meager spade

#

Remote print string works for me and then it stops

#

@meager spade I am streaming now, so maybe you can hop in

meager spade
#

you tried removing the delay to see if thats causing issues

viral raft
#

Nope'

#

I will try

meager spade
#

how do i see your stream

viral raft
#

@meager spade Discord profile ;0

#

gewoon_jaap is my twitch

meager spade
#

im watching

viral raft
#

Ah okay!

#

I will open the level blueprint 😃

#

If this shitty thing saves 😄

#

@meager spade Okay it should be live now

meager spade
#

just see OBS 😄

viral raft
#

I see

#

@meager spade Here a screen

#

Need to eat

severe nymph
#

Hey guys. I’m just now getting into multiple client multiplayer so this is my first go at something other than using switch authority to send to server vs local. I know multicast is a bit heavy but is there some optimal way other than multicast to send info to all clients for things like play animation nodes or spawn emitters

#

And think about it in the case of weapon fire cause I know level content can be handled a bit differently with replication

meager spade
#

I think multicast is the way to go for things on all clients

polar garnet
#

Pretty sure that I've read the same as @meager spade is saying. If it's for artistic purposes, definitely use multicast

#

Hey guys. I'm really confused about something. I can't seem to wrap my head around the difference between IOnlineSession and UOnlineSession. I would expect that UOnlineSession is a class that just implements the Online Session Interface (ie. IOnlineSession). But that doesn't seem to be what I'm seeing in the code. I was trying to write a class ("MyClass") implementing IOnlineSession by inheriting from it. However, when I do this I get this error: "Class 'IOnlineSession' has an incorrect prefix, expecting 'UOnlineSession'"

#

Anyone know why I can't inherit from IOnlineSession?

meager spade
#

IOnlineSession is an interface

#

UOnlineSession is a class

#

wait you said that, lol ignore me

#

@polar garnet i see class FOnlineSessionOculus : public IOnlineSession

polar garnet
#

Yea

#

I was expecting that to mean that I needed to create my own class implementing IOnlineSession. Which is the class I'm getting the error on

brittle sinew
#

Are you attempting to make a class with a prefix of U?

#

If so, I believe UHT expects it to be a UObject, which means it must inherit from some type of UObject in addition to implementing the interface.

meager spade
#

does UHT really do that? that's good to know

#

class FMyOnlineSession : public IOnlineSession would work

polar garnet
#

I didn't use any of the standard Unreal Prefixes at the start of my class name. But I think you're on to something @brittle sinew

#

I think I know where I might have messed up. Give me a sec...

meager spade
#

UnrealHeaderTool requires the correct prefixes in most cases, so it's important to provide them.

#

so yeah UHT will check the prefixes

polar garnet
#

I think I may have fixed it... but I have one more error to fix to be sure. I created this class in VS without using the UEed class wizard or editor (because I couldn't find the IOnlineSession interface in the editor), so it got created outside of the source folder (both the .h and .cpp were in the same folder). I have since migrated these files to their proper locations in the /project/source/* directory, and I have since deleted Binary, Build, .vs, and Saved and recreated solution files. But I'm still having an issue where my class isn't able to include my .generated.h file.

brittle sinew
#

Could you show your header?

polar garnet
#

Yea. I think it messed up because I had included a UClass() macro

meager spade
#

have you put that include in the header aswell? the MyClass.generated.h, i often create classes in VS never had issues with not getting the generated.h

polar garnet
#
#pragma once

#include "OnlineSubsystem.h"
#include "OnlineSessionInterface.h"
#include "CoreMinimal.h"
#include "Engine/GameInstance.h"
#include "FastTT_IFastTTOnlineSession.generated.h"

class IFastTTOnlineSession : public IOnlineSession
{
public:
    IFastTTOnlineSession();
    ~IFastTTOnlineSession();
};
#

That's my header. Just realized I misinformed you guys

brittle sinew
#

Your class shouldn't start with I—you're implementing an interface, not making one.

polar garnet
#

I DID name my class with the I prefix, but I meant to say that my FILE name didn't conform

brittle sinew
#

Also, there's no need for a generated header.

#

They're generated when you use UE macros—usually things like GENERATED_BODY or U<CAPS>

#

They're not generated if you don't need them.

polar garnet
#

I see.

#

So in this case a generated header isn't even created

#

?

brittle sinew
#

Correct.

#

If you want to, you can check out implementations in the source.

#

Notice the class is prefixed with F, and that there's no generated header.

polar garnet
#

So. If I were trying to make an interface that was derived from IOnlineSession to implement in other classes, would I go about doing this the same way?

brittle sinew
#

You're trying to make an interface?

#

You're not trying to implement one?

polar garnet
#

Actually yes. I said implement before, but I guess the truth is that I'm actually trying to make my own. I was trying to implement the interface to play around with the functionality, but my actual end-goal is to create my own interface with all of the same functionality as IOnlineSession + some. To be implemented in my own projects.

#

Sorry for the confusion.

brittle sinew
#

Hmm.

#

Can't say I've attempted interface inheritance before, but I think it should work as long as you're keeping it native C++?

#

Once you start implementing interfaces on UObjects, SHTF.

#

😄

polar garnet
#

yea. That was the intent

#

Lovely 😄

#

Thanks for the pointers. Helped a lot

subtle peak
#

@brittle sinew
The target BP is returning a "no owning connection" warning in the log, but the actor I'm trying to hit is placed in the world. It does not have a playercontroller attached to it. Do I need to spawn it through the server on begin play?

subtle peak
#

Or would it work if I set it to multicast?

severe nymph
#

I wish I understood why if I have a replicated actor and a component (directional light) and I send a switch authority rep server function remote from a client to toggle the visibility on the server the server player sees it the client calling the function sees it (cause I have a local non rep local function in the chain) but the other clients do not .... do I literally have to multicast everything even on replicated actors so the other clients see the changes

winter harness
#

@thin stratus Thanks, yeah I have gotten the windows version working, its getting the linux dedicated working with gamelift that is being a major pain in the arse. While I could just throw my hands up and go with windows for simplicity, when you do the math and realize that running linux spot instances is 84% less expensive than windows that adds up REALLY quick soon as you start scaling up. I mean $8.14 a month vs $48.44 a month is a staggering price difference when looking at operating costs.

#

@severe nymph Are you sure the server is actually getting the message and you are just seeing your local version change? If it you are firing it on an actor from the client, you don't have ownership on that actor, so the server is likely to ignore the RPC from the actor. Ownership and RPCs are linked hand in hand, especially when trying to do stuff from blueprints. You need to send your RPC from something you own, and the only thing you are really guarenteed to own as a client is the PlayerController. so RPC should be sent from the player controller to the server, with info about which actor you are requesting to change.

severe nymph
#

@winter harness yes it’s getting there because the server player can see the light component toggle on

#

But my 2nd client won’t

#

I’m setting owner from get owner of player controller in bp

#

That’s all working

#

But it’s like the server isn’t replicating the visibility of the light component of the replicated actor

#

Back out to clients

#

Granted it works if I call a server rep that then multicast that function but I thought the point of replicated actors was to not have to do this

#

Do I have to set replication on the light component within the actor as well to have the server update its state to clients and then won’t have to use multicast?

severe nymph
#

Looks like I need to setup a rep notify variable of the light visibility state @winter harness for it to work the way I’m thinking it should

#

Then call function that sets that variable on the server from the client and it will rep to all other clients without multicast

winter harness
#

Yeah you can either let all clients know they need to turn it on/off or flip it on the server and no where else and let the server be authorative about it. If you are just doing peer-peer listen servers authority is not as important, so you can handle it a few different ways. if you ever intend to allow dedicated servers and want to prevent easy cheating, you should always make sure the server approves and handles all changes etc.

severe nymph
#

Well it’s a VR game using the vrexpansion plugin which has grip replication per actor plus the actual actor replication. The plugin has client authority for grips so they are really responsive but handling something like flashlights in multiplayer... you want all clients to know that someone else has theirs on because of gameplay dynamic involved. I will eventually setup dedicated servers so I want to go ahead and structure it correctly. @winter harness

winter harness
#

Then Send the RPC from the client asking to turn on the light, if the server approves, then toggle the bool and use a repnotify on all clients to turn the light on.

#

Simplest way to do it. or you could set the light variable if the light is replicating, but replicating a simple bool toggle can be more efficient and simpler.

severe nymph
#

Multicast has a chance of not making it to a client based on relevant checks but rep notify will update the client once they become relevant

winter harness
#

Allows you handle logic locally as well if you have conditional visual stuff and not be tied directly to the light if you wanna change how you do it later.

#

I avoid multicast as much as possible, Just make the actor replicate and replicate the bool variable with notify to let the client handle the change.

#

Avoid unecessary network traffic and keeps it really simple.

severe nymph
#

I’m assuming there is an event created based on rep notify variable changes?

winter harness
#

First off are you using blueprints or C++?

severe nymph
#

So if it’s seen by a client fire client side chain

#

Bps

winter harness
#

ok then when you set the variable to notify it will create a function on the actor

#

OnRep_<VarName> I think

severe nymph
#

Awesome

winter harness
#

And in there you handle the logic

severe nymph
#

So on that event switch authority remote do logic

#

And on local event switch authority has authority set variable

#

Easy peazy

winter harness
#

So Client (Asks server to turn light on) -> Server sees if the character has a light and it can turn on. If true Server (Sets bFlashLightOn) to true which is repnotify. That bool is replicated to clients, including the original sender and fires the notify function. In that function you can read bFlashLightOn and if its true, turn your light on locally for the client.

#

So you never set it on the client, only ever set on the server.

severe nymph
#

Oh .... got ya

#

Will there be a delay?

winter harness
#

Nothing noticable unless there is terrible latency to the server.

#

You could always assume it will work, turn the light on or off locally, and then once the repnotify event caatches up you can correct the state.

#

Would result in flicker when client and server dont agree.

severe nymph
#

Hmm I think I can ya I was just going to say that

winter harness
#

Thats a very simple form of clientside prediction. Assuming something then correcting once it gets the real info from the server, keeps things smooth and responsive.

severe nymph
#

Since the state will force match server even if the event runs locally first

winter harness
#

yeah. In most cases it would be fine and only in cases of high latency would you have any real noticable delays, but that can work fine.

severe nymph
#

I’m assuming it’s less bandwidth than rpc calls too

winter harness
#

Well you still need to send the RPC to turn the light on to the server.

severe nymph
#

But I mean it’s a bool

winter harness
#

Yes better than doing a multicast for sure.

#

and it obeys relvancy of clients.

#

so someone not near the client doing the light action doesnt need to know about it and is not notified till they become relevant

severe nymph
#

Awesome

#

Thinking I need to do the same for my level bp directional light rotation so server and client sync

#

Rep notify the rotation

winter harness
#

You have two options with movement. You can replicate movement, which can at times be stuttery and unpleasing. You can also try to do the movement locally as well but it may end up fighting the server and jumping around.

#

If it doesnt actually matter in the end which way the light is pointing and is just visual, then don't replicate any movement and just toggle the rotation from the server with a notify.

#

You can also rotate locally and on the server without replicating movement, which will usually visually work well and provide very smooth movement, but also handle any collisions correctly since the character movement is replicated from the server ideally

severe nymph
#

It’s a dynamic day night cycle

winter harness
#

In that case you should never replicate the movement of the lights etc.

severe nymph
#

Gameplay dynamic would need client server sync

winter harness
#

The only thing you really need to replicate is the time.

#

And not that often.

severe nymph
#

Everything is driven off a sun height variable

winter harness
#

One of the fundamental best practices for networking is only replicate just as much as you need to infer information for complex events.

#

So if you replicate a float 0-1 that represents where you are in the day night cycle

severe nymph
#

Client can handle everything else

winter harness
#

You can use that to drive everything visually on the client. No need to replicate anything else typically unless you have some other stuff like cloud density etc you want to replicate.

severe nymph
#

Nah just sun height

winter harness
#

And id recommend updating rarely and interpreting in between.

#

So the sun only goes up and down and not around?

severe nymph
#

It going all the way around 90 is noon

#

-90 midnight

winter harness
#

Ok so rotation angel not height.

severe nymph
#

Correct

#

Dynamic material on clients handle skybox

#

Based on that 1 value

winter harness
#

regardless I would suggest not updating every frame, and just sending out an update every say, 5 seconds from the server, and in between do local interpolation

#

Just keep the network data sparse where you can to leave room for everything else.

severe nymph
#

Yea I’ll handle client and timer on event rpc the rep notify

#

Let it update the clients over what they think it should be every 5 seconds

#

Bump it up to 10 if it’s pretty smooth

winter harness
#

Yeah

#

I do mine every 60, then just interp to server time + 60 till the next update.

#

anyways you can handle the logic locally, those are just gfood practices.

sharp spire
#

Question for the crowd, I have a UI attached to an actor in the game that isn’t owned by anyone (listen host by default, as it’s a listen host game). I have items in that actor that are attached to that UI via buttons. I want the players to be able to click each button and remove each item. (Got all that working in multiplayer) is there a way to get the UI to update for everyone who happens to have that UI open?

#

Tricky question as the UI has no controller 😒

#

Would setting it to repnotify and setting the UI to replicate possibly fix my issue here? Lol I also have a server event setup in my pawn class to handle input for the actor for server reasons (not the only method I’ve tried, but gave it a shot just Incase)

#

Wellrepnotify with refreshUI in the function

sharp spire
#

figured it out thanks

wary depot
#

If I were to have a certain number of actors which were "owned" and controlled by a specific player and looking for input from only that specific player, would the proper way to get input from each player for them be to save the player that spawned them in a variable upon their spawning and then look for input from the player saved in that variable?

#

For example: A hand of cards (Each of which is an actor) in a card game and each player has their own hand of cards that they are able to use.

sharp spire
#

spawning actors has an Owner Pin just click the dropdown

#

@wary depot

#

but for simplicity sake, id atleast save them to an array in your pawn

wary depot
#

Alright I'll try that

sharp spire
#

it'll work

#

im not entirely sure why youd need an actor for each card though, unless that was an example only lol

wary depot
#

I was basically trying to make a Yugioh VR game a few months back but put it off once I started having problems with multiplayer replication. I'm thinking of going back to it

#

The deck is basicaaly entirely comprised of actors that the player can pick up in VR and then place on the gameboard

sharp spire
#

that would make a lot more sense lol

#

also make sure that a player controller is spawning these said actors, or replication wont work

#

through a server rpc

wary depot
#

Yeah the replication got really freaky and I honestly just think I may need to improve my multiplayer foundations and basics

#

Ye for sure, I need to change that

haughty carbon
#

Hey. I made a System and the calculation is done inside a Component. The component doesn't gets replicated to the Server 🙄

#

Any Fix?

#

The Component is a Variable

sharp spire
#

that is way too vague, could you share more details? @haughty carbon

haughty carbon
#

Wait Lemme Show You

#

Overlapped ATM Wallet Component

sharp spire
#

are you sending the changes through an RPC?

haughty carbon
#

yeah

#

Shouldn't I do That

#

?

sharp spire
#

yes, but to my understanding an RPC wont be accepted unless sent from a player controller

haughty carbon
#

So can you suggest me a way to Replicate that variable?

sharp spire
#

personally i send a lot to my Pawn to tell the server to run the command

#

but im sure theres a better way out there, as im hardly dealing with any outsider actors atm

#

but there also may not be a better way to handle it lol

#

what exactly are you trying to change? your code just seems a bit confusing to me

#

the majority of things that your character does, should remain in your character. always keep code as close together as you can.

haughty carbon
#

I have a Player Character and A Bank Teller! Both have the same component attached. When I have the Withdraw option selected the Actor has to deduct money from the component of Banker!

#

It Works properly at single player

sharp spire
#

but servers need hard references

haughty carbon
#

But when coming to multiplayer, as server is does the function properly

#

but as client the server is not able to get which bank teller i am interacting with

sharp spire
#

because its a soft reference.

#

i may be entirely wrong, but your method just sounds complicated for no reason..

#

why didnt you just make all variables inside your pawn and when interacting with the bank teller, bring up a UI that moves the variables around..

haughty carbon
#

Well everything inside the Pawn? But a component will be easy to attach to any pawn or Actor?

sharp spire
#

why does it need to be attached?

#

are you keeping transaction statements inside this component?

#

even so id just recommend using a struct that has an array to handle things like that

#

sending whats inside that component by keeping track of it with a struct is a lot easier to send back and forth from actor to actor

#

im not trying to tell you how to code, as its always a choice. but when it comes to my opinion; then that seems to be the smarter method to avoid any issues

haughty carbon
#

I am getting the point

#

But I am not keeping any record of transactions. Just calculations and Function inside the Component

sharp spire
#

move the function to your pawn is my suggestion :\ keeps it cleaner and always has reference to a controller

#

or you can see if anyone else in this room has more experience with components, as it wouldnt be my choice in method so i've avoided them

#

im actually not even sure how you managed to create a component that has so much attached lol

#

but something to keep in mind, if a client tries to make any changes to a server related item, itll disregard those changes as it thinks youre cheating

haughty carbon
#

Oh!

#

Will keep it in mind!

#

But I nhave done a lot on this already

#

Just pass on the component reference to Server and everything will be fixed

sharp spire
#

And any future changes to the server component yes 😃

#

@wary depot there’s someone in #ue4-general looking for VR guides if you have any advice or links for them

tender gale
#

Is there anyone around here that's built a custom multiplayer/networking layer for Unreal? i.e. not using the built in networking.

worn nymph
#

yes there is a few im currently building one now and there are others if you search the forums

#

@tender gale

tender gale
#

@worn nymph Do you have any links/posts/etc. on this stuff?

worn nymph
#

well mine is still in early stages . i have a working server but so far i have only finished the login system

one i know about a freind of mine built called the open world system
@glad knot

you have the mmo kit from code spartan

and the rest you will just have to google and search for

tender gale
#

Thanks 😃 I'll look around

verbal wave
#

Are there any good multiplayer AI examples?

twin juniper
#

i am going to be doing a pathfinding system for my 6dof game and it will scale from singleplayer to multi by just using replicates movement / replicates turned on

#

oh it is blueprint based - the pathfinding will be done using a plugin 😃

crimson lily
#

Hello all. Im looking for a good dedicated server tutorial.Anybody can share tutorial link ?? Thanks

severe nymph
#

@haughty carbon just curious if creating the component input on your rpc solved your problem

#

I have full clip actors without owners I’d like to be able to overlap in the world and client gun would reload. The server spawns the actor so I would assume it’s the owner but I’m getting inconsistent destroys when trying to destroy. Wondering if passing the actor into the rpc will solve

verbal wave
crimson lily
#

@verbal wave thank you so much.im looking now

verbal wave
#

At your service

crimson lily
#

its for dedicated server right?

verbal wave
#

Um.. read the title

crimson lily
#

oww ok i see now 😄 thnks again

verbal wave
#

Good luck

spiral badge
#

Hey all i am trying to make an easy team selection so on level i put a default pawn named spectator inside i made an event begin play event to cast a widget with 2 button 1 for team red and one for blue.
Inside the pawn i made 2 custom event 1 for team red and 1 for blue to spawn the correct character but i have no idea on what i have to put in to change the pawn

#

Maybe an enumeration can help but can’t figure how to make it work

#

Here the widget

spiral badge
#

Anyone have an idea?

hasty adder
#

Here’s a clue @spiral badge

#

But if you want a half broken example project I have one on my Dropbox for ctf in blueprints but it’ll need to be converted to newer engine prob I last worked on it in 4.13 I think

spiral badge
#

Really?

#

Can i ask if you can share it?

hasty adder
#

Sure one sec

spiral badge
#

Thank you sir! 😄

#

you made my day

icy nacelle
#

Any ideas as to why this prints twice when I have three clients playing, once while two clients are playing?

twin vault
#

only server have all controllers, all clients will fail

icy nacelle
#

Seriously?

#

So I'm going to have to move everything from controller to my character?

twin vault
#

im afraid you will have to, bounty sounds like a character property, if its a new character, its a new bounty, if he dies, the bounty disappears

#

the controller is persistent

icy nacelle
#

Ah, I'm not actually killing off players like that

#

I've made my own death function

#

I'm not sure you're right @twin vault
Turn to page 39 of the compendium and it says that each client owns a controller.

twin vault
#

yes, its own

#

and server own all of them

#

if you calling that function from the server thats fine

#

just player A cant see bounty/playercontroller of player B, without server accessing it first

#

but as you were saying, looks like its called once from each client

icy nacelle
#

So can I make a call to the server to retrieve the bounty of the target player?

twin vault
#

yes

icy nacelle
#

Alright thanks, I'll do that then 😃

boreal vine
#

hi

severe nymph
#

Anyone put voip in on 4.18.2?

#

Any guides out there?

#

Sorry 4.18.3

boreal vine
#

im running an rpc on server to spawn an actor, once that is don how do i trigger something on the player character?

#

everything after the server rpc runs on server but i want one thing to only run on the client

boreal vine
#

or after the server spawns object I want the client to have a refrence of it

meager spade
#

quick question

#

GetDefaultPawnClassForController_Implementation what would cause that not to be called

glacial hamlet
#

deriving one of the functions in the chain before it could have that effect if its simply not getting called and deferring to other logic

coral dock
#

Hey all. I'm looking to speak to a network engineer that has experience with secure profile servers for microtransaction based cosmetics (platform agnostic). I'm a gameplay programmer myself and need to get a better understanding of conventions and best practices in this area before hiring developers for this side of development. Happy to email or jump on a call and of course pay you for your time. Shoot me a message if you have some time to discuss - would be excellent. Alternatively any book recommendations on this topic would also be appreciated.

fringe dove
#

is there a way to send two unreliable RPCs and ensure they are sent on separate packets? (low bandwidth latency critical message that I want to have some added protection against packet loss with)

verbal wave
fringe dove
#

@verbal wave some/all of that is about property replication; I'm trying to get an RPC to be sent twice across multiple packets

verbal wave
#

I don't think you have control on sending a RPC seperatedly

fringe dove
#

@verbal wave will reliable stuff be sent on separate packets from unreliable or are they combined?

verbal wave
#

If the packets are really small you can consider sending them like 30 times per second until recieving a message from recipient saying "we got it, stop"

#

Faster than a Reliable call. Skip the gap between recipient requesting resend and server sending it again.

fringe dove
#

yeah, I just don't want the multiple sends to get bunched up in one packet

verbal wave
#

Using ForceNetUpdate is the only easy way I know 😃

fringe dove
#

ah, so forcenetupdate will flush pending RPCs?

#

I thought it was just for property replication

verbal wave
#

Actually I'm not sure. In my experience RPCs and properties are treated alike.

#

Someone wiser please hop in!

fringe dove
#

ok, where I think I've seen that used is to override Adaptive Network Update Frequency

#

that's where a property is checked for replicate less if it is updating less

#

seems to call FlushNetDormancy and SetNetUpdateTime(GetWorld()->TimeSeconds - 0.01f);

#

flush net dormancy is definitely related to that adaptive update frequency

verbal wave
#

Mighty @fossil spoke , sorry for the summoning, but does ForceNetUpdate flush pending RPCs?

fossil spoke
#

I wouldnt think so. Id imagine it would only be for Property Replication

verbal wave
#

Net update frequency has direct control over the frequency RPCs are sent though

#

So I always thought when engine wraps packets, properties and RPCs are treated alike

fossil spoke
#

I honestly couldnt tell you, @gleaming vector might be able to enlighten.

fringe dove
#

I think they both go through sendbunch, but I wasn't aware net update frequency had any effect on RPCs

fossil spoke
#

I thought it was just for Props

gleaming vector
#

ForceNetUpdate only marks the actor as dirty for replication

#

which only considers properties

fringe dove
#

you guys see my original question?

fossil spoke
#

Yeah i thought so

fringe dove
#

I'm trying to send multiple RPCs

#

multiple duplicate RPCs

gleaming vector
#

good luck with that

fringe dove
#

and have them split on different packets for redundancy

gleaming vector
#

it's best to batch them

fringe dove
#

I intentionally want these in particular unbatched to get more reliability against packet loss

fossil spoke
#

I would have thought that the Engine would cull any duplicates ?

gleaming vector
#

just use the Reliable tag

#

Reliable RPCs require an ack

fringe dove
#

I want good latency characteristics too

fossil spoke
#

If the same RPC was going to be sent in the same bunch then whats the point in sending it redundantly

fringe dove
#

I will be sending it reliable as well

gleaming vector
#

I would recommend not doing this through the high level RPC system

#

but instead taking a look at how net channels are implemented

#

and implement it on the channel/driver level

fringe dove
#

I'll check into that

gleaming vector
#

RPCs are too far above network latency/packetloss/reliability level for good fine tuned control over that stuff

fringe dove
#

I'm assuming multiple actor channels can get batched and have packet overlap too right?

gleaming vector
#

yes

#

there are a few classes that shape packets

#

but reliable RPCs are reliable

#

in the general definition of reliable

fringe dove
#

yeah, I'm not trying this as a reliable guarantee or anything

gleaming vector
#

it's just an ack 🤷🏽

fringe dove
#

I know, I'm saying I'm not like using this in place of reliable in a way that is going to cause me issues

#

I'm doing some emulator networking where input is very low bandwidth

fleet sluice
#

Why not use sockets yourself? Do you absolutely need a UE4 reflected function?

gleaming vector
#

UNetDriver is the main class you want to check out for packet shaping

#

@fleet sluice that's not a good idea

#

UE4 has a really solid layer above sockets

#

and you can swap out what kind of socket you use

#

you can, for example, run the entire UE4 networking layer over websockets

#

if for some reason you are fucking crazy and want to do that

fringe dove
#

yeah I don't want to do raw sockets unless I have to for this

fleet sluice
#

There's nothing stopping him from using the in-use NetDriver object's socket (whichever class the NetDriver may be) though

fringe dove
#

actor channel etc. is already handling a lot of stuff I wouldn't want to recapitulate

gleaming vector
#

I dont really see why you would approach it this way but hey, NetworkDriver.cpp is where you want to start digging

fleet sluice
#

I'm referring to the regular BSD sockets returned by PLATFORM_SOCKETSUBSYSTEM macro in 'ISocketSubsystem'

fringe dove
#

ideally I'll add a UPROPERTY specifier like unreliable or to be used in conjunction with it that will tell it to send twice and not batch together

fleet sluice
#

Which are totally independent of the NetDriver and allow for the fine tuning he wants

#

Ah I see

fringe dove
#

and it can still batch with other stuff

fleet sluice
#

That's going to be a lot of digging by the way

fringe dove
#

just not be batched together with its duplicate

#

yeah I won't put it in until later since there is no stock way to do it

#

it isn't critical, it just would help

#

for now I'll send reliable and on the next frame send again unreliable

#

so if there is packet loss it will eventually get there from the reliable, but it will also always send another attempt without waiting for full roundtrip delay

gleaming vector
#

technically sending an rpc multiple times is not reliable

fleet sluice
#

Also, Steam's sockets are pretty fast and reliable

gleaming vector
#

you could potentially drop the same packet 3 times in a row

fleet sluice
#

Might want to check that for easy NAT traversal

gleaming vector
#

or more

fringe dove
#

yeah I know

#

but the first time I'll send it as a reliable rpc

#

so it will eventually get there from that

#

but I'll go ahead and send it again the next tick as unreliable

#

so it will get there faster if there is packet loss on the first one

gleaming vector
#

Vlad it's just a tunnel

#

a really cool tunnel

#

but steam sockets are just a really simple tunnel

fleet sluice
#

Yea, but they're already built, that's all.

gleaming vector
#

yeah

#

just need the steam client

#

although valve appears to be fixing that

#

at their own time i guess

fleet sluice
#

I'm all for custom solutions, designed from ground up, but I'd personally like to know all possible "variants" before I start digging. I may be subjective here.

gleaming vector
#

oh, they did finally release it

fleet sluice
#

Actually they released it on its own

gleaming vector
fleet sluice
#

Hold on

#

Yea

#

My point exactly

#

I was just going to link that.

fringe dove
#

yeah, it doesn't do hole-punching and stuff from what I heard

fleet sluice
#

That's correct

gleaming vector
#

no, you need Steam for that

#

because Valve makes use of the steam service to do NAT punchthrough

fleet sluice
#

I haven't used the standalone Git version yet, but I've used the SDK version plenty. There may be differences, but I'm fairly sure it's the same.

gleaming vector
#

ya know, because they have a massive network of content distribution servers and they can just do that

fringe dove
#

yeah, you should be able to run a STUN server and do it yourself though

#

they probably do many different methods though

#

because they work with everything

fleet sluice
#

Why run STUN when Google has tons for free?

fringe dove
#

oh, I didn't realize

#

for now I'll be sticking with steam anyway

fleet sluice
#

TURN/ICE is what I'm having difficulties finding

#

At least cheap and reliable haha

fringe dove
#

I'm surprised epic hasn't put out a hole-punching solution though

fleet sluice
#

I'm considering building one with UBT myself

#

You mean... Like Unity? #warning-incoming

fringe dove
#

did UT4 have p2p or always hosted by epic?

fleet sluice
#

They used to provide a MCP plugin with UT

#

Hosted by Epic

#

They have a MCP framework, in-use by UT and probably FN and Paragon as well. @warm pagoda may know better.

#

Anyway, the UT team used to distribute that MCP plugin which is proprietary. It's possible some people have it still.... ✅

fringe dove
#

@fleet sluice what does MCP stand for?

fleet sluice
#

I have no clue. It's Epic's abbreviation for their master server and the related framework, but I don't think I ever saw it expanded

#

Not even in the plugin itself

#

They should just open-source that

#

Or at least release some API

fringe dove
#

ah, no hole punching involved with that though right?

#

not connecting between two NATs

fleet sluice
#

I don't really remember. I haven't touched UT in 2 years

fringe dove
#

maybe some kind of authentication/encryption

fleet sluice
#

And I have no idea if they changed anything networking-related since

fringe dove
#

do they use oodle with fortnite or is that too cpu heavy for them?

fleet sluice
#

I don't know anything about FN, for certain

#

I used to mod UT before I became interested in the engine itself so FN and Paragon are out of my area of knowledge.

#

Sion (the guy I mentioned above) is your best bet for FN questions

solar stirrup
#

How does UE handle input, do you have to handle it yourself or is it out of the box for client prediction/server simulation?

fossil spoke
#

Not sure how helpful Sion will be with anything other than UI.

fringe dove
#

@solar stirrup character movement component handles prediction rewind/replay stuff

fleet sluice
#

And there was a really good post about how Paragon's servers are being scaled, how lobbies are being managed etc. by one of the devs a while ago. I can look that up if you want, but it's not technically related to sockets.

solar stirrup
#

alright neato

fringe dove
#

otherwise for the most part you have to implement it yourself, I think they have taken some steps to modularize it for use outside of character

solar stirrup
#

fair enough

fringe dove
#

you have to use something like blueman's vehicle plugin for vehicle replication with rewind

solar stirrup
#

still better than Unity's UNET

fringe dove
#

but characters work really well

solar stirrup
#

thanks

fringe dove
#

don't be fooled by the built in vehicle template multiplayer.. it doesn't work well at all with any lag or packet loss

gleaming vector
#

pretty much everything is better than UNET

#

but I hear they are redoing it

solar stirrup
#

idk if they're redoing it but UNET is a pain ¯_(ツ)_/¯

fringe dove
#

think I figured it out; this won't optimally batch other data, but it seems I can just send the first RPC, call FlushNet, then send the second.

summer nova
#

unity is completely scrapping UNET and creating new networking systems

#

those new networking systems are with the new ECS, wich makes sense, as ECS makes networking trivial (thats why Overwatch uses it, or MMOs)

toxic pawn
#

Hey guys, I have a small question about implementing character head rotation. That is a very important gameplay thing and other players have to see it as good as possible. The way it currently works now is that it takes the current rotation of the player controller attached to the character and applies it to the head bone of the mesh. This all works just fine in single player, but when testing it out in multiplayer i realized it doesn't work at all. Now I figured that is a normal thing given that clients only know about their own controllers, so I figured it would be a good idea to just use the camera rotation instead. That turned out to work great too - but only in single player. I had to also make sure the rotation was sent to the server when the client would update it, so I did so with a run on server event. However, a very strange thing started happening afterwards. The head turn shows perfectly fine on the server, but not on any other client. Any ideas what might be wrong?

lean river
#

Playercontrollers exist only on client and server.
That means client know his pc and server knows all pc

#

Whatever you replicate in pc that would be replicated only to owning client

#

Same with rpcs PC cant invoke multicast events

toxic pawn
#
  1. I know player controllers only exist on owning client and server. That's why I chose to use the camera instead.
  2. I didn't invoke a multicast event. I just used run on server.
  3. What do you mean whatever I replicate in pc?
#

@lean river

full bane
#

it is replicated by default

lean river
#

If you forward rotation in pc via server event and you try replicate that to other clients .. will not work