#multiplayer

1 messages ยท Page 577 of 1

winged badger
#

@lucid vault OnRep_Controller

twilit oak
#

not sure if this is the right channel btw

winged badger
#

or SetPawn override

wild frost
#

If I were to replicate variables inside of the player state, would that mean that all players could see the variables? or would that not work?

lucid vault
#

Yes

#

Player state replicates to everyone

lost inlet
#

@twilit oak this is probably an outdated guide, and there's plenty of them when it comes to OSS

#

also is it the OSS you're after rather than the SDK specifically

twilit oak
#

ah thats no good for me. becouse it wont compile atm, and i suspect it might be becouse i couldent do that step

#

idk? i guess both would be good having. i tought the SDK was required for the OSS

#

do you know a more up to date guide perhaps?

lost inlet
#

well the steamworks SDK is already distributed with the engine i believe

#

it should be present in Engine/Source/ThirdParty/Steamworks

#

the OSS links the steamworks SDK like so

twilit oak
#

hm, and i allready replaced it with one i got from valve

lost inlet
#

upgrading the steamworks SDK should be fairly trivial, the engine uses 1.47

twilit oak
#

so i have to follow epics guide on eveyrthing except messing with the SDK

#

?

#

yeah i got a 1.50

#

i must have touched something i wasnt supposed to touch anymore =/

#

guess ill compile a new engine and try again

lost inlet
#

well you'd have to update Steamworks.build.cs to point to the right version

twilit oak
#

i did tough

#

error: no member named 'ReceiveMessagesOnListenSocket' in 'ISteamNetworkingSockets' when compiling

lost inlet
#

which outdated guide were you following

lost inlet
#

oh

#

that's not outdated

#

but since you were upgrading the SDK from 1.47->1.50, there may have been deprecated functions that the OSS is calling so you'll have to update those yourself

twilit oak
#

oooh, i did not think about that being a possibility

#

is SteamSocket.cpp part of OSS?

lost inlet
#

if it's in that plugin, which it sounds like it is, then yes

twilit oak
#

thanks! i just had to fix that one removed function tough i have no idea if my "fix" works at all lol

lost inlet
#

you only have to care if the fix works if you're planning on using steam sockets rather than normal IP connections

twilit oak
#

i dont even know the difference

lost inlet
#

you'll probably use normal IP connections if you plan on having dedicated servers where you connect to it by IP address

twilit oak
#

yeah "dedicated server" wich will be my 20 year old potato in the basement XD

carmine citrus
#

I am in the middle of creating weapons and I see that the Shooter Example uses a replication graph to manage updating dependent actors. Is this the 'best practice' way of handling equipping other actors?

jolly meadow
#

i am making an IP multiplayer and everything updates normally but actors doesnt update

near carbon
#

I keep having trouble with steam done everything in the documentation all plugins are in. One second it worked then the next it was no longer working. I am doing it in blueprints I have also put in steam advanced sessions.

#

I created a working version in 3rd person template to get it up and running, and that got it to work on my project but now it does not work on my project or the 3rd person template which makes me believe it is something in my engine files

lime wren
#

@near carbon try in standalone

near carbon
#

i got it back up it was something with the advanced sessions plugin in but now when it goes to join the lobby it gives me a fatal error

lime wren
#

show me

near carbon
#

Assertion failed: ProcessedTexture [File:D:/Build/++UE4+Licensee/Sync/Engine/Source/Runtime/Engine/Private/Rendering/SkyLightImportanceSampling.cpp] [Line: 395]

#

Thats the crash in the cpp file line 395 is

#

check(ProcessedTexture);

#

So i dont know what i have set up that is having this crash

jolly meadow
#

i am making an IP multiplayer and everything updates normally but actors doesnt update

near carbon
#

Check your events and make sure they are firing on the server. That made updates show on my clients

jolly meadow
#

?

near carbon
#

What are you trying to send through?

jolly meadow
#

i want to move this

#

like to show on the client

#

and its a physics object

near carbon
#

all its movement needs to go through the server to update the clients. Physics are annoying in networking

jolly meadow
#

how can i do that?

near carbon
#

i would recommend going into your project settings and restrain your frame rate if it is a physics game to 60fps and go ahead and turn on async and substebbing for replications

#

Ill go into a voice channel and see if i can help you out

jolly meadow
#

i cant rn

near carbon
#

Ok i dont have all that checked and my physics vehicle shows up on my client

#

are you using events to move the ball

jolly meadow
#

are you using events to move the ball
@near carbon no its just a physics object

near carbon
#

ok are you replicating the phsyics bodies then

jolly meadow
#

its 2 am

near carbon
#

is the ball just pled there

jolly meadow
#

so i have to go to sleep will u be online tommorow 2 hours earlier?

near carbon
#

yeah just hit me up

heady python
#

does the savegame blueprint spawn for each player in your game? I want to get each players settings and apply them while there are multiple people in a lobby. Would savegame be able to hold each individual players settings or no? Also a similar question for game instance. Does a game instance spawn for every player or just 1 per level?

rose dock
#

how do people typically structure their inventory or weapon systems for replication? right now I have a WeaponComponent that internally uses a Weapon class that inherits from UObject for implementation details about how the weapon works (hitscan/projectile/etc/)

Now that I'm struggling to find docs on how to properly replicate this UObject, I'm curious how people usually do this.

#

im just wondering at a high level how people organize code for things like items and weapons into the Actor/Component/UObject hierarchy

mainly I don't know the right way to properly handle and replicate items or weapons that contain instance-specific state

thin stratus
#

@rose dock UObjects by default don't replicate.

#

That's why, at least in BPs, people use Structs

#

You can look up subobject replication to learn how to replicate UObjects

hybrid zodiac
#

@shut loom the issue is that you're just launching whichever player happens to be first in the list of players rather than the player who actually touched the box

#

What you should do is grab a reference to the player who stepped onto the bounce pad and pass that to your launch event so it always launches the player that stepped on the pad

#

For a listen server and all clients, the player at index 0 is ALWAYS the locally controlled player

#

So it would be player 1 for the server, and player 2 for the client

#

What I would do is not bother with a server function, have a "has authority" switch leading from the overlap event and only launch the overlapping character if has authority is true

#

No need for the client to tell the server to launch the character; the server already knows because it has its own overlap event

#

Just cast "Other Actor" to your character class and launch it on the server. Launch is replicated automatically to clients

#

Just leave it, take "Other Actor", cast to your character class and launch them on the authority

#

That's it, just hook the base character up to launch

#

Oh sorry, get rid of the custom event, just plug the cast directly into "Launch Character"

limber gyro
#

are level blueprints suposed to execute on the server by default?

#

@shut loom you are probably changing the speed localy but on the server, so the server is trying to correct you or vice versa

glacial burrow
#

im currently working on an ability that has a cast time, when the time is done, an actor should spawn at the casting players mouse location.
How would i do that with an authority server? can i sync all the mouse positions of all players all the time or should i look for another solution?

limber gyro
#

with an RPC

#

@shut loom

glacial burrow
#

okay i figured it out ๐Ÿ™‚

ancient summit
#

hey, can i get some help? ๐Ÿ˜ฆ

foggy idol
#

The player array in the game state is giving me 2 player states even though I'm the only one in the level

#

And everytime I respawn a player the value increases

glacial burrow
#

I have 2 actor blueprints, with one i have no problem spawning it on the server and showing it to the players, the other one does not show up at the players. I did a simple option somewhere but where ?

#

okay im stupid

#

got it fixed too ^^

#

and the last question for today: I have a variable in my Controller, an aim point, it does not get replicated because the controller on the client and server arent the same object, right ?

glacial burrow
#

i now have a call from my client to the server every frame which updates the aim point, does UE4 bundle them together and updates it periodically, or do i flood my server with nonsense ?

unkempt tiger
#

Question about the general way actors's properties are replicated:

#

Are all properties updated together in the same "net tick", or is each property updated at its own time? Assume of course that there was a change in their value so they do require networking

winged badger
#

all properties changed between 2 updates are in the same packet

#

and all replicated properties, changed or not, are in the packet that spawns the actor on clients

quick flint
#

Anyone here know how to do testing in multiplayer?

#

I recently read the sea of thieves game gdc presentation and they basically said they used the Unreal automation system to do tests

#

Currently i have some tests setup, but im not sure how to get them to work in a multiplayer environment

#

has anyone any experience with this?

twin juniper
#

Can u tell me how to solve delay between server and client

peak sentinel
#

You mean lag?

lost inlet
#

Iโ€™m not sure how you can defy the speed of light and ISP networking hardware

meager spade
#

@twin juniper if you ever work out, enjoy your noble prize ๐Ÿ™‚

twin juniper
#

haha

meager spade
#

you can not get rid of the delay

#

but you can hide it from the client as much as possible

twin juniper
#

I am moving object so I have to face problem for bith

#

both

#

so it is moving for server and client

meager spade
#

ie, when firing a gun, you can allow the client to activate and start firing, then tell the server, this way the client feels the responsiveness

twin juniper
#

did not understand

quick flint
#

Soooo

hybrid zodiac
#

@twin juniper so rather than the client sending a message to the server and waiting for the server to respond, the client can send a message and then just assume the server will get the message and do whatever

twin juniper
#

@hybrid zodiac great

#

How to implement

#

@hybrid zodiac can u Help to implement

lofty kelp
#

it kinda impliments on it own already

#

are you using standard ue networking and replication?

#

In most cases with the built in replication you dont need to do a lot of prediction on the client side, if you use the built in work flow and stuff most of its already "built in" for you

#

for intance if an npc throws a fire ball and it hits a player, do not worry about sending a message to just the server and the player that takes the damage, use the built in events for applying damage and it will handle what needs to be done on the server and what needs to be replicated to the clients, you can almost "pretend" you are making a single player game.

#

assuming you arent trying to support more then about 32 players in any given AOI

jagged stag
#

would GetWorld()->GetPlayerControllerIterator() be the same as get all actors of class (PlayerController) in BP?

lofty kelp
#

I "believe" its mostly the same

#

I think there are a couple detail different

ancient summit
lofty kelp
#

the reaon i that the joined session doesnt own the new pawn so it cant give it updates

#

the server owns the pawn and has auth of it

#

you either need to change your respawn to make the client spawn their own pawn

#

or you need to change your keys to make it sends requests to the server

ancient summit
#

how i make the client own it?

#

and thanks for the quick answer, ur awesome!

lofty kelp
#

the client owns what the client spawns

ancient summit
#

and isn't it enough to set the new player as owner on onpostlogin?

lofty kelp
#

hmm not sure about the second part

ocean geyser
#

is anyone here familar with asp.net? i have a master server build in it with a mysql database. im making a heartbeat so i know if a player hosted lobby is down or not (if it is remove it from the database) so i setup a tcp socket in UE4 for the master server to connect to only when the lobby is open, i tested this and its working via a separate c# app. the issue im having is moving this functionality to my asp.net master server, im not sure how i can create a single task that runs forever to perform this heartbeat on the master server

ancient summit
#

how i make the on post login send the client a message to spawn

lofty kelp
#

@ocean geyser I am only midly familiar with asp.net but i think there are routing issues with web sockets in asp.net that you have to config for

ancient summit
#

like where i need to create the custom event of spawning the pawn

lofty kelp
#

@ancient summit do it when the client joins the server/map

#

the client "knows" when he is connected to a game map already

ancient summit
#

kinda noob on the multiplayer, so i don't know in what blueprint is the client when he joins the servere

#

like, so far i called the owned pawn, and than did some function with it

#

the session*

ocean geyser
#

@ancient summit in your Pawn/Character class there is an event called OnPossess

#

from a quick skim it looks like your able to join and possess the pawn just without the ability to move, so OnPossess should fire for you

ancient summit
#

So what i need to insert on the Possessed event?

#

Sorry for being noobish, trying too learn multiplayer after 3 years of development

ocean geyser
#

depends on what you need. im not 100% sure what your issue is, but generally in the game modes PostLogin event you would spawn your pawn and possess it using the passed in controller

ancient summit
#

that's exactly what i did

#

and they are all getting spawned correctly on the player start choosed for them

#

and when i just start the lobby level (with the pawns), without a lobby

#

i can control them

#

the problem starts when i join a session

#

the host of a session can control the pawn

#

but the joined members can't

timid moss
#

Is there a way to manually replicate a float variable so it replicates only when I want it to instead of the engine automatically replicating it every time it changes?

ocean geyser
#

@timid moss set a custom condition

timid moss
#

would this be COND_Custom?

ocean geyser
#

yes

timid moss
#

The comment next to it says // This property has no particular condition, but wants the ability to toggle on/off via SetCustomIsActiveOverrideIt seems like with COND_Custom it is treated as a toggle. But I was hoping to find a way to just tell it to replicate at a certain point in code instead of toggling on/off. Is that possible

ancient summit
#

I really need help, pls... i can't find any solution to this problem

river estuary
#

@timid moss Afaik there isn't any other way, but just call a method on the target server/client with the argument and turn off replication for the variable.

hybrid zodiac
#

@timid moss In principle, you could achieve this by simply tying the COND_Custom to a boolean value which you then flick on/off. However, I read somewhere that you shouldn't really use it for values that change frequently as it can hurt performance

#

Though I'm not sure what "frequently" means, or how much it hurts performance

timid moss
#

Are there any examples on overriding SetCustomIsActiveOverride?

#

i guess id have to inherit from IRepChangedPropertyTracker

hybrid zodiac
#

I've never used it, unfortunately

normal jacinth
#

hi, for some reason i'm getting a default character spawning even when i set Pawn to none in the game mode. only happens when i play as client.

thin stratus
#

Are you spawning your own Character on Client and Server?

normal jacinth
#

ah possibly

#

that was it thanks

ancient summit
quasi shoal
#

I just want each client to see its own actor spawn i dont want other clients to see it or even care about it

heady python
#

does the savegame blueprint spawn for each player in your game? I want to get each players settings and apply them while there are multiple people in a lobby. Would savegame be able to hold each individual players settings or no? Also a similar question for game instance. Does a game instance spawn for every player or just 1 per level?

quasi shoal
#

Game instance is part of the server so yea every one as access to it

winged badger
#

ummmm

#

no

#

Game Instance is not replicated in any way

#

and each machine has their own (so each player as well, unless its splitscreen)

quasi shoal
#

thats true that is why RPC arent called in Game instances and good for things like widgets

quasi shoal
#

So i see why one does spawn and the other doesnt cause one is in editor play and the other is in standalone

hollow stirrup
#

What's the best way to pass information to the server during absolute server travel? I want to send the selected character to the server so it knows which data to spawn the actor with, I don't want to do this via a controller RPC as I'll have to wait till PostLogin to do that, and the data I want to send to the server is a character UID that it uses to pull data from a database via an async function. I want to make this https call during Login, so that it can be running while the client is still connecting to the server. As it stands right now, if I do it via a RPC then there is a 10-15 second delay after the pawn spawns before the game is actually playable due to having to wait for the https response. Sure I could hide this behind a loading screen, but I was wondering if there was any way I could get this data to the server faster. Maybe by passing it in via the Options string on the Login function? Not sure how that works or how to set that options string. I did some code digging and I could find where that string gets set

marsh swallow
#

Please ping me.

What do you suggest I use that is COMPATIBLE with unreal engine 4+ for an MMO servers consisting with at least 2000 players per server. Maybe 10000. Something kinda like World of Warcraft but not exactly

chrome bay
#

@hollow stirrup you can't send any info to the server during absolute travel because you're disconnected

#

If you need a connection that isn't tied to the game traffic, you could look at setting up a beacon. Seamless travel is generally preferred anyway.

near bison
#

Is there any way to persist game mode variables across levels while seamless traveling?

#

Think of it this way: my game has day and night cycles, the day level is different, night level is different, but I need to keep track of the elapsed no. of days in some central state

#

I don't think gameInstance makes sense to do this, as I'll have to have a local copy of this on every client

chrome bay
#

Put it in the game state would be my suggestion

#

Also don't forget, game states/modes are actors and can have components of their own. Helps if you want to compartmentalise behaviour

random nymph
#

Does anyone have experience of getting aws flexmatch info to client from some other route than describe matchmaking?

ancient summit
fossil spoke
#

@random nymph You can use SNS and/or Lambda

random nymph
#

Yeah but I'm bit of stuck figuring out where to go from SNS

#

Should I use some sort of socket system where the aws end knows when to send data about match to certain clients, or should I poll a lambda function with client with some parameters and then the lambda would return correct matchmaking info if it has something stored for the client?

fossil spoke
#

That last option is the recommended approach by AWS.

#

Essentially you push the Flexmatch Ticket states to a DynamoDB via SNS.

#

Client then polls the DB via Lambda

#

For their Ticket State

random nymph
#

Okay that sounds reasonable. Is there any kind of tutorial of how to do this or how do you know it is recommended approach by AWS?

fossil spoke
#

We have contacts at the GameLift team.

#

Flexmatch -> SNS Topic -> Lambda -> DynamoDB

#

Thats the basic flow.

#

Client -> Lambda ->DynamoDB -> Lambda -> Client

#

If that makes any sense in that format ๐Ÿ˜›

#

This also means that you wont ever hit the maximum GameLift function call limit.

random nymph
#

Yeah that makes sense

fossil spoke
#

There is a limit to how many requests to a GameLift function can be made.

#

You dont want thousands of concurrent users making calls to DescribeSessions for example.

random nymph
#

Yeah

#

Do you have any pointers or code to share of your system as I'm not yet familiar with sns, lambda or DynamoDB ๐Ÿ˜…

fossil spoke
#

I cant share our code, but i do remember someone doing a pretty indepth tutorial on this. Ill see if i can find it.

#

Covers pretty much the setup im describing.

random nymph
#

That would be amazing

fossil spoke
#

Pretty sure its this one.

random nymph
#

Okay I'll take a look. Thanks!

fossil spoke
#

Good luck. Any questions just ask.

random nymph
#

๐Ÿ‘Œ

peak sentinel
#

Each video is 2 hours lenght and it explains every little details ๐Ÿ˜ฎ really thanks

rich ridge
#

@fossil spoke thanks man, you answered my question too..

fossil spoke
#

๐Ÿ‘

ancient summit
#

When A player joins session i can't move the pawn, it is possessed but can't move - why is that? what's preventing it? when i host a game - i can move the player, so the input on the character is fine i guess

bitter oriole
#

Is it possessed on the server

solar stirrup
#

Local & Remote roles are the same for listen server hosts right?

upbeat basin
#

I'm working on reconnection case and using PlayerState.EventOverrideWith on BP (thanks Cedric) to get old scores. Cast to my player state class is successfull but I get default values instead of the old ones that set before quitting level. Is there something that I need to do or take care before expecting my values to be saved?

bitter oriole
#

@solar stirrup For host-player-owned actors, yes

solar stirrup
#

awesome thanks

bitter oriole
#

Erm, no

#

The remote role is often going to be simulatedProxy

#

The local one will be authority obviously

shrewd frigate
#

Hello Guys I have a problem with server travel

#

I noticed that after the server travel has been done, the game mode still maintains that Of the previous map

#

It causes My game to break. Any help will be appreciated

near bison
#

@chrome bay aren't variables reset on seamless travel?

shrewd frigate
#

?game=/Game/pathtoGameMode I saw something on adding this option to the Url but it still does not work. Still uses the game mode of the previous map

ancient summit
#

How i pass a nickname from Main Menu (which contains the settings menu) to a lobby level when joined session?

#

I want to show the name above the character, i have a text render above the character

#

I need to pass the nickname between the levels (Menu and Lobby)

#

What i need to do when i change the Nickname field on the Main Menu Level Settings Widget?

balmy gazelle
near bison
#

@ancient summit you have to decide where to store the nickname. You can store it in GameInstance, and then use that in your lobby to set the name

ancient summit
#

But if i store it on the GameInstance, it's will override it for the other clients, no?

near bison
#

Each executable running will have its own GameInstance, no matter which machine it is on (server or client).

#

lol @ancient summit I'm implementing the same thing rn and I'm actually kinda stuck too. It's not replicating correctly (the TextRender)

#

I'm not sure if it's befcause I'm pulling the name from game instance or something else. It's setting the same name for every client

balmy gazelle
#

Can't you request each client their name and each client read a savedgame to get the name request ?

near bison
#

why saved game?

balmy gazelle
#

the clients savegame

#

because is a static storage

#

with other client stats

near bison
#

does save game persist across levels?

balmy gazelle
#

well yeah is a external saved file

near bison
#

sounds overkill for something so simple

balmy gazelle
#

well when a user enters into a game have to send different stats, the name is one

#

rank etc are stored there, where is the overkill ?

near bison
#

wouldn't I rather fetch the rank etc from online subsystem

#

this is an MP game

balmy gazelle
#

what ?
Well you have to request the info to the connecting user

#

Where otherwise you want to get it ?

near bison
#

from a database somewhere?

balmy gazelle
#

well then you're looking for a complex system

#

old games used to do that up 2012 or so, now you're looking for a managed system with servers and infrastructure I imagine

near bison
#

I mean yeah, I'm gonna store this name in a DB somewhere that I'm gonna fetch everytime the user starts the game

#

it's not that complicated

#

it's like... world of warcraft storing your character's name somewhere. and no, don't tell me it's using an engine's save system, it's obviously gonna make an API call to some db

balmy gazelle
#

yeah that case is different, you need a master server and sub servers to store that

#

or use steam api or the store you're using etc

twin juniper
#

Good time of day. Need to create game launcher where the player can download the updater for game and read the news. Any ideas?

balmy gazelle
#

yeah a master server for you too where store the news etc on a json or a datatable

#

but these systems aren't "multiplayer as is"

#

are network systems

ancient summit
#

I'm not sure if it's befcause I'm pulling the name from game instance or something else. It's setting the same name for every client
@near bison in my case the host get his name, the other names cast to character fail...

unkempt tiger
#

Are FNames net serialized efficiently by default with some ID?

#

Or for example, a character's hit bones - should I write some net serialization logic that associates each bone FName (e.g head, leg_r, spine_1) to, say, a unit8?

rose egret
#

@unkempt tiger they are serialized just like FString, for bone names and things like that use UEum its even better that uint8

ancient summit
#

Is GameInstance local?

unkempt tiger
#

@unkempt tiger they are serialized just like FString, for bone names and things like that use UEum its even better that uint8
@rose egret Thanks for replying! Enum makes a lot of sense, only HitResults (from the engine) return bone names as FNames, and needing to convert them to enums is as much work as mapping them to uint8s inside net serializers afaik

rich ridge
#

@balmy gazelle convert your textures into bytes and do RPC.

#

You better compress that texture

viscid escarp
#

Hello! Actors are not being read when far from pawn. Already set "always relevant"(and replicates ofc) and problem persist. Any idea?

thick sparrow
#

Any ref to reduce lag for rotation in multiplayer client ?

twin juniper
lofty kelp
uneven cliff
#

@thick sparrow One thing I found helped was turning off "Orient Rotation to Movement" in the character's movement component

#

I'm having an issue changing character meshes. The server sees everything correctly, the client sees the mesh they chose, but the client sees the default mesh for everyone else. I can change the way I spawn characters to make this work, but that would mean spawning a new character and replacing the old one when a player changes their mesh in game.

normal jacinth
#

I'm having a fairly basic replication issue. In my GameState I create a 'LockedObject', which in turn creates a child actor Door. How should I set up the replication for the blueprint message that opens the door?

north swan
#

hi guys. can you give me pointers on how to implement player specific vision? e.g.: player A's mesh is visible to player B, but not to player C.

jagged stag
#

Could someone help me with this newbie question please?
Does anyone have the correct way of setting up bullet spawning (could be any other gameplay-relevant class too)? I'm trying to do a simple left click on client -> spawn fake bullet locally & spawn real bullet on server & spawn fake bullets on other clients
My current setup is as follows but I don't know if it's the right way of doing things

round star
#

I am trying to create a lobby menu that has the server info and a chat. It works fine to create it as the host, and a client can find it..but the widgets dissappear from client for some reason

#

shoudl the lobby menu be set from the player controller or game instance

cerulean escarp
#

lobby menu should be a player controller thing because you only want the client to see it

#

er wait

#

I think what I did in my game was have the client ask the game state to create the widget, and if valid the game state would create it for that specific client

#

that way when you're in game it doesn't do anything weird

ocean geyser
#

@round star i set that system up in my main menu using widget switcher along with beacons to replicate the info in the lobby along with the chat. when the lobby is created successfully it moves the host to it via the widget switcher, when a player joins successfully it moves them to it via the widget switcher

ancient summit
echo snow
#

@ancient summit by any chance did you play with the gamemode functions?

ancient summit
#

@echo snow What do you mean?

round star
#

Welp. I've spent the last 3 days trying to get this to work and now I am so lost in all the functions and blueprints

#

scraps the menu and restarts

lapis dew
#

Seeking Opinions:
What's a game idea where people NEED face to face communication to succeed?

echo snow
#

A dating game @lapis dew

#

Also have you ever played LA noire?

meager fable
#

Hi, I have this function that is getting called on my eventPostLogin

#

but I'm getting an error "Only local player controllers can be assigned to widgets. LobbyPlayerController_C_1" is not a local player controller"

wise atlas
#

Setting up multiplayer is cancer

soft girder
#

It can be the first few times

#

Network replication out of the box is the main reason I chose ue4 tho

#

@meager fable

#

You figure it out yet?

meager fable
#

nope

soft girder
#

I cant see really well on my phone but it looks like your calling your widget script from inside game mode blueprint?

#

If so the game mode blueprint only runs on server side if irc

meager fable
#

yup it's in the game mode

soft girder
#

The way we did it we put our widget creation script inside the player controller blueprint and had a multicast event infront. We called that multicast event from the cast node right after post logon

#

That way the server only makes a call to clients and the clients themselves do the widget creation on their own

#

I'm at work or i would send some pictures.

meager fable
#

setting SetupLobbyMenu to multicast didn't change anything, not sure if that is what you meant

soft girder
#

Still same error?

meager fable
#

tup

#

yup*

soft girder
#

Ok go to where that function is in the lobby controller bp and screenshot

meager fable
ruby rock
#

Watching with interest - I swear I'm going to open source a simple, working UE4 MP intro system ๐Ÿ™‚

soft girder
#

Ok idk if this will work but we will try. Prob a way better way to do what I'm bout to tell you but doing this will tell us what the problem is.

#

Click and highlight the red set up lobby node. Add an input

#

The input type needs to be lobby player controller and it needs to be blue

#

On the other end in the game mode blueprint you will feed the value from player controller in.

#

Once you get the value of lobby player controller being passed through the function call your going back to the red node. Drage the blue out and check if its locally controlled.

#

On true fire the rest of the widget creation.

#

On false do nothing

#

I dont think there is a way to perform the check in the game mode or I would have you do it the other way

#

You could also pass the integer and just make sure it equals 0

meager fable
#

yeah the thing is that it's not the locally controlled PC so it still does not create a widget for my clients

#

only for the server

soft girder
#

Oh

#

Did you try it?

meager fable
#

yup

#

nothing changed

soft girder
#

Oh I see

#

Is that widget like for a list of players?

#

You want a widget for each player on every client?

#

Or just one for each client

meager fable
#

yeah, list of all players, character selection ready button etc

soft girder
#

Ok my bad

#

I thought it might be for individuals

#

Ok we need to do this differently then

#

Is this a listen server?

meager fable
#

yup

soft girder
#

IRC player controllers only exist on client. Server only one who keeps copies of them. Everyone has player controller 0. But server starts count 1 and up beyond.

#

In this case the way you had it setup would be okay I think

#

The server is the one who needs to check

#

Wait

#

Wait wait

#

Show me a screenshot of your player. Controller function

#

What it looks like now

meager fable
soft girder
#

Okay that's where the error is coming from. It's the copy the server has

#

We want to only fire when local.

ruby rock
#

So would that need a check for IsLocalController?

soft girder
#

Ya but I think he tried that

meager fable
#

yeah but that is never ran for the local controller

#

only for the server

#

not sure if I'm thinking correctly

soft girder
#

Drag out the blue and type is locally controlled. Hook it to the branch and screenshot real wuick

#

I just wanna make sure what it looks like when you try it that way

meager fable
soft girder
#

Okay good. Out if false print a string and plug the blue value into the string

meager fable
#

when i run the game i get server: Lobby player controller 1 printed out

soft girder
#

Do you still get the error?

meager fable
#

i dont get the error bc the code doesn

#

doesn't run

#

but i dont get the widget creation

soft girder
#

Hmmm

#

Theres something I'm forgetting

#

I had this exact problem a few months ago and I cant remember what I did

#

We are on the right track hunting it down tho

#

Is any of the players getting a widget?

meager fable
#

only the server

soft girder
#

Ok

#

Good

#

We are close

#

Is lobby controller set as default for map?

meager fable
#

yup

soft girder
#

Instead of locally controlled try a has authority node

meager fable
#

that still doesn't make the function get called on the clients PC

soft girder
#

For some reason that function isnt even getting called from game mode for the clients playercontroller

meager fable
#

yup

soft girder
#

Show me the pic when it gets called

meager fable
soft girder
#

Take away the local and authority check

#

See if you can replicate from server to owning client instead of multicast

#

There should be an option in there

meager fable
#

that's how it was originally set up

#

but

#

oh god

#

I didn't make it reliable

#

that was the issue

soft girder
#

Shit

#

My bad

#

I should have mentioned that

#

My boss is mad cuz I wont get off my phone

meager fable
#

suppose that was hard to see from a phone hahah

soft girder
#

I was like" man that's gotta work"

#

Lol

meager fable
#

I should have also seen that

soft girder
#

Sorry

#

XD

meager fable
#

np man thanks for your help

soft girder
#

Np your very welcome

meager fable
#

tell your boss I'm sorry for stealing his worker ๐Ÿ˜„

soft girder
#

There are a bunch of weird caveats when working with listen server setup

#

I have a flash function in the hud that o can only make work on server or all other clients

#

I think I know how to fix it now tho

meager fable
#

yeah I just started working with multiplayer and it's a lot to handle for a beginner

ruby rock
#

So can I ask a really dumb question? Whats the difference between local and remote?

meager fable
#

but knowledge always comes with a bit of struggle

soft girder
#

Ya

#

It gets easier

#

I promise

#

Eventually you start dreaming about blueprint nodes lol

meager fable
#

good sleeps solves problems better than staring at your monitor till 3 AM

soft girder
#

@ruby rock a remote would be like client pc when in terms of server. Local means the machine the code is running on.

#

No doubt. On the sleep. Its alot easier to solve something when rested. I went nuts on a sound loop that would reset when muted last night. Found out that inside the sound cue there is a setting called virtualize and I had to set it to play when silent

ruby rock
#

@soft girder - so would that then mean you would have a local/remote (truly remote client - connect over internet) and a local/server (listen server)

soft girder
#

Yes but I think from the client perspective it would just be local. IRC the server only views the client as remote

#

That's a really good question I'm gonna have to do some digging on that to get a clear definition for remote

ruby rock
#

I think I am overthinking it - but it seems to be the root cause of what looks like 90% of ue4 networking issues ๐Ÿ™‚

#

I kind of think a wiki page that shows a matrix of varying options would save a lot of heartache ๐Ÿ™‚

ruby rock
#

So my next question would be if you wanted to store variables in the GameState and have those replicated out to clients, can you use RepNotify?

winged badger
#

you can

clear sand
#

Hey guys

#

it is necessary to close UDP socket on game exit on mac os OS ?

#

For now, when I try to close it - it just throws ERR_BAD_ACC

soft girder
#

I have never had that error before

#

But I have only packaged games for windows

#

Does closing the socket stop the error? @clear sand

#

I searched for that error on google and nothing came up

clear sand
#

nope, it actually works fine if I do not stop socket upon game shutdown

winter stump
#

hey everyone. we are having an issue where we are trying to get a first person spectator camera in our multiplayer game. but when we set the view target to another player we are getting this stuttery lag. its not a smooth replication of what the other player is looking at on his client. any ideas?

ruby rock
#

@winged badger - how? I mean if you set a variable like "Score" to be repNotify in GameState, the notify function appears in the GameState. What if you wanted that to be created in say the PlayerController? Is there a trick there?

plucky sigil
#

Does anyone know why SetViewTargetWithBlend doesnt work on clients ?

soft girder
#

@winter stump is the listen server the one lagging?

winter stump
#

@soft girder its a dedicated server. and the client is lagging

#

unfortunately he never mentioned if he found the fix ๐Ÿ˜ฆ

soft girder
#

I had an issue with a lock on mechanic. I did something to where is was smooth on clients but was trash on server

#

Have you tried linear interpolating the camera to the position?

#

And I would also look into the network update frequencies for the actor in question.

winter stump
#

makes sense that it could be a network update frequency issue @soft girder im looking into it now one moment

soft girder
#

Hey

#

I think it's the rotator var

#

The rotation value that gets replicated has less precision in the decimal places.

faint imp
#

do you know where the rotator var is?

soft girder
#

I would still check into all that other crap I said but look for the precision of rotation

#

I'll be home in an hour or two

#

I remember seeing something about rotation precision

#

Its either in controller or the character bp

#

There is a setting that can double the number of decimal places or cut it in half. Keep in mind it would be sending bigger numbers of network

#

You could just manually replicate with is reliable

#

And then set to the number replicated

#

Sometimes we gotta do stuff dirty to make it work

#

Bam

#

This thingy

faint imp
#

i changed it to double precision

soft girder
#

Did it help?

faint imp
#

still pretty laggy

soft girder
#

Damn

faint imp
#

i think it helped slightly

#

nation

soft girder
#

I seen that vid and hiw it was snapping to locations that were just close by. Might could increase the network tick of the bp

#

Update rate

#

Is this spectator thing a built in bp?

faint imp
#

just increased to 80 for both controller and pawn

#

didnt work

#

yeah just using SetViewTarget to view them

soft girder
#

Oh ok

winter stump
#

its definitely looking like its the precision. the mouse is just snapping in little increments

#

instead of smooth

soft girder
#

I was gonna say could build your own spectator character class

winter stump
#

but i guess it could be network related....

soft girder
#

And then just set location to target location on tick

#

Wait should the update rate decrease or increase?

#

A smaller number means a smaller interval

#

Bigger number might make it lag more

faint imp
#

nah

#

the number is how often per second

#

increasing precision kinda helped tho

soft girder
#

Kk

#

This will actually help me out later

#

Spectator is something I need to do soon

faint imp
#

thanks for the help man definitely pointing us in the right direction

#

will keep trying stuff

twin juniper
#

Hey can any one help me to change duplicate an actor if it's position is changed anyhow

kindred widget
#

@winter stump Out of curiosity, when you were testing this with the little snapping. What was the server's framerate? If you're relying on replicated variables, the server having a lower framerate will slow your replication time since you can set the replication frequency as high as you want, but it'll still only replicate once per frame and look a little snappy.

hoary spear
#

The video looks more than just randomly snappy imo

#

It looks controlled..

soft girder
#

Mattxor is typing

#

The knowledge is bout to drop boys

vale ermine
#

so im thinking of how things will save and load in my game. 1: save items to dynamo db on obtaining item in game and save item in save game object per unique user. 2: If user has not logged into server for more than 7 days, during server maintenance dynamodb is updated for user using users save game object and save game object for user is deleted from /Game/Saved/SavedGames. 3: If user is active within past 7 days, keep and use save game object for unique user and do not use dynamodb. 4: Dynamodb is only invoked when A: new item is obtained or B:User is returning from being absent for 7 days to recreate save game object. Does this sound good?

soft girder
#

I dont know a whole lot about dynamodb but that sounds good to me

#

Sounds effective really

vale ermine
#

I am just trying to think of a way to keep requests as low as possible

soft girder
#

Cleaning everything out every week

#

Could you write to the dynamo and then delete on confirmation?

vale ermine
#

but I don't want a bunch of inactive user data on the server

soft girder
#

Right

#

Reading this is kind of gave me ideas on ways I could be handling arrays better

vale ermine
#

During maintaince my script would look to see who has not been logged in for 7 days. it would then set the user data to dynamodb and delete save object for user.

soft girder
#

Kk

#

I think it sounds awsome but I have never worked with any large db before

vale ermine
#

Yea me either but I picked it up quick using the multiplayer plugin on the maket place. 200 bux

soft girder
#

Damn

#

I'm gonna have to check that out

vale ermine
#

Everything is complicated and they have a good tutorial but it is missing something things. This biggest learning curve would be learning to write your lambda functions. These are the functions you invoke from Ue4. You can write these functions to make changes to dynamobd. So yea writing your functions and making sure all you key pairs are set right in your ue4 blueprint matching the tables on your dynamodb. That way when your lambda function makes the call to dynamodb you can get set query what you need.

ancient summit
#

I have a problem in which my session joined player, can't send input to the pawn. The possession succeed but the input is like... disabled. Hm... i tried to enabled input on posses, didn't help.. any suggestions of what can cause it? why the host is getting the input normally, but clients are can't move or do any input action.

#

@gritty lodge If a variable is not replicated - only the client will see action triggered by this variable.

soft girder
#

@gritty lodge there is a boolean check called is locally controlled and then there is another check called hasAuthority. the locally controlled is what it says. has authority varies to what class your working in.

#

@ancient summit can you screenshot the input script

#

make sure replicates and replicates movement is ticked

ancient summit
#

@soft girder And the Set Move Direction is connected to the "Get Set Movement" Event

soft girder
#

are you doing sometype of custom movement?

ancient summit
#

hmmm some snappy movement

#

like, the rotation is snappy to 8 angles

#

not 360

soft girder
#

ok

ancient summit
#

The bug occurs only when I Join A Session through a mainmenu map to a lobby map

#

when i open the lobby map without join a session, and just set the num of players on the multiplayer options to 2

soft girder
ancient summit
#

they all get an input

#

yeah

#

exactly

soft girder
#

ok

#

just making sure

#

thats odd for it to only happen through a join session

#

gamemode set up right or is it a gamemode base?

ancient summit
#

Set up to a custom game mode

#

The spawning and possesing happens on the GameMode, is it okay?

soft girder
#

ya

#

thats right

#

does the map have the default gamemode set to this mode?

ancient summit
#

yeah

soft girder
#

you prob have all that stuff right in the project settings defaults as well

ancient summit
#

The Custom Game Mode is also the game mode one my game settings

#

is that alright?

soft girder
#

you could switch them and switch them back. ive had bugs happen once when i moved the location of the gamestate and game mode to another folder

#

ya

ancient summit
#

So reset the settings and try hook it up again?

soft girder
#

you shouldnt have to unless you moved stuff around in the content browser

#

like between folders

#

in that case you will have to right click on folders and fix up redirectors as well

#

you could give it a try tho

ancient summit
#

Is it okay to connect the BeginPlay and the OnPostLogin to the same function of spawning?

soft girder
#

nah

#

it would fire twice

ancient summit
#

but when i connect it only to the begin play - only the host is spawnd

#

and the onpost login spawns only the clients

soft girder
#

make sure this stuff is right

#

hang on ill show you what i did for that

#

wait thats really odd

#

my host spawns from event post login some how

#

hang on i bet it really dont fire for host

#

no mine fires for host and clients like this

ancient summit
#

Lol now i managed the input problem but i have different problem

soft girder
#

what engine version are you on

#

4.25?

#

sorry go ahead

#

what was the input issue?

ancient summit
#

4.24

#

well i'm now sure where the problem is

soft girder
#

cool

ancient summit
#

it's on the post login

chrome bay
#

That delay is an instant red flag to me

ancient summit
#

When i did it like u did, only the host is spawning lol

soft girder
#

i cant remember why i had it set like that

upbeat basin
#

I'm working on reconnection case and using PlayerState.EventOverrideWith on BP to get old scores. Cast to my player state class is successfull but I get default values instead of the old ones that set before quitting level. Is there something that I need to do or take care before expecting my values to be saved?

soft girder
#

removing the delay seems to have no effect

ancient summit
#

If the camera is not set to the camera on the Character, does that mean the possession didn't work?

soft girder
#

besides no delay

#

ya dont do it it exactly like i did it

#

thats something i wired up just to get ppl shooting each other

#

i did not set things up properly like playerstate and such in this project

ancient summit
#

Now the thing that happens is that the new player that joined the session

#

controls the host

winged badger
#

thats what you get for using GetPlayerController/Character[Index] without fully understanding it

ancient summit
#

Yeah, I know i don't fully understand it

soft girder
#

lol

winged badger
#

i'd wager you have a GetPlayerController/Character[0]

#

evaluated from a Server RPC Event

#

but the thing is, its not evaluated on the client that sent the RPC

#

its evaluated on Server in that case

#

and on Server it doesn't evaluate to same Controller/Character

ancient summit
#

The thing is i don't get it

#

is BeginPlay is a thing that only the host does for the GameMode?

#

and the Event Post Login is for the clients?

winged badger
#

only because Clients don't have a GameMode

#

but yes

ancient summit
#

can i show a screenshot of my current gamemode spawn func?

soft girder
#

plz

winged badger
#

you can paste it here, but i am just paying attention while im compiling

soft girder
#

sorry Jamblax said the delay was red flag so i wondered why i had there in the first place

#

i packaged and we are testing

#

so far looks like there was no reason for it

#

i think i put it there when i fd my redirectors up

#

thinking initial setup needed more time or something

#

ended up being gamemode moved into a different folder and not being reset in project defaults

ancient summit
vale ermine
#

so even better. apparently I can use Amazon S3 to save player save games to. Then there is the new S3 Plugin that just got added to the marketplace. By doing it this way, I will avoid having to use Lambda and Dynamodb.

ancient summit
#

Any way to make the Spawn func work fine?

vale ermine
#

you will have switch on authority. put a print there you will see it run through server and client

soft girder
#

why the delay?

vale ermine
#

you need to make a custom event

soft girder
vale ermine
#

run on server

soft girder
#

everything works without that delay so im leaving it out

stark fractal
#

Hello,

I have trouble when the player disconnects my whole game breaks cause i route everything ingame through the controller. So is there any chance not to destroy the controller on disconnect or i have to rewrite the code ?

soft girder
#

dude is right. delay should be a red flag that something is seriously off somewhere

ancient summit
#

Lol man u took it really serious, u deleted it, it's all fine

soft girder
#

ya but its good to be like that. later on the delay may have caused a head ache and it is bad

vale ermine
#

no some times you need the delay so other things have time to get set up but you not the best way to tackle bad code

soft girder
#

i havent opened that gamemode in ages. i was wondering why you had to use begin play to spawn your host

#

i went to make sure before i told you that event postlog on should work for host

#

delay has its moments ๐Ÿ™‚

#

@stark fractal dont use controller like that

#

it took me a while to wrap my head around player controller

#

but its going bye bye when they leave so even if you called it from an array stored on server im pretty sure it wont be valid

stark fractal
#

@soft girder so i have to rewrite all the code ? :////

soft girder
#

well there is a copy paste

stark fractal
#

because all the calls go through my controller

#

AAAAAAAAAA

#

thanks i guess

stark fractal
#

fk

soft girder
#

XD

#

sorry you had the matrix icon

#

i had too

stark fractal
#

AHHAHAHAHA

soft girder
#

let me see whats going thru tho

stark fractal
#

well i have bunch of mingames

soft girder
#

oh damn

stark fractal
#

which players go through

soft girder
#

server teleport simp ๐Ÿ™‚

stark fractal
#

HAHAHAH

#

its the character pawn

soft girder
#

im glad im not the only one who does that

#

ya

#

things like that would need to be moved

stark fractal
#

i guess everything will stay in game state

#

i have 70% of the things going through in game state, i have to transfer them there

soft girder
#

anything that deals with that player controller could stay but anything you gotta fire after its gone

stark fractal
#

well ye i understood it the hard way

#

when i decided to check hey whats gonna happen if i dc :/

soft girder
#

its ok

#

thats how we learn

stark fractal
#

this is my first serious multiplayer project

#

soo i learned a lot by now

#

all others were fail

#

i think this one will go through

#

cause i managed to get it work 100%

soft girder
#

ive rebuilt my entire project prob 3 times from scratch lol

#

ill prob do it again after i finish blending animations

stark fractal
#

yee i've done that with my last 2 projects

#

i got tilted

#

and after i finished them i made them more optimized

#

from scratch*

soft girder
#

i had one break on me but ill show you something really funny

#

back over a year ago when i first started i did this

stark fractal
#

HAHAHAHAHAHAHAHAAHHAAHAHAHAHAHAHAH

ancient summit
stark fractal
#

THIS SHIT MAKES ME CRY

#

AHAHAAHAAHAH

soft girder
#

lol

ancient summit
#

now i have something like that

#

and still - the player can't ove

#

move*

#

the joined player

soft girder
#

that looks good

#

i have a feeling its something to do with the movement

#

also i thought a switch has authority in gamemode will always be true tho?

#

anyways

ancient summit
#

yeah i guess... but the movment is working for the host but not the client

soft girder
#

it works in PIE tho?

#

in editor?

#

just not through join session

ancient summit
#

no, now it's not working on editor

#

Like when i open 2 windows

#

the host have input

#

and the client don't

soft girder
#

okay

#

sounds like your getting closer

#

get rid of that node after tick

#

as long as replicates and replicates movement is set to true add movement input and set actor rotation should work automagically

#

hang on ill boot a test project and just plug that pic you gave up

ancient summit
#

ohh it is lol

soft girder
#

wait does it work

ancient summit
#

on the editor it's working fine

soft girder
#

good

#

you were setting that call every tick

#

there was no input running through that replicated call so not sure what happened on the other end

#

prob default values

#

you can add inputs to events and replicate the values through them

#

i dont know why i didnt say to stop that ticking call off the rip

#

i thought maybe you had something else going on

#

character movement has built in replication

#

vehicle movement needs to be done in c++ i think or you could wing it with a bunch of replicated functions and node mayhem

ancient summit
#

but it's not about replication

#

the thing is that the joined session player can't get input

#

not even a normal input

#

like a have an ability input

soft girder
#

where is the input coming from

ancient summit
#

which is a normal press event

#

what do u mean by that?

soft girder
#

like the press event

#

show me that

ancient summit
#

i think the problem is on the PostLogin/BeginPlay

#

because on the editor the input works fine for all of the actors

soft girder
#

ability light moves the character?

ancient summit
#

no...

soft girder
#

i unhooked these to just show that something like this works with the settings i posted above in replication. as long as your guys are spawning post logon they should be able to move

#

how many blueprints have you made in your project?

ancient summit
#

not much, not more than the basics

#

character, instance, gamemode etc.

soft girder
#

ok

ancient summit
#

i'm trying to get the host/join session to work

#

and than i'll keep creating the gamelevel

soft girder
#

is it a server travel?

ancient summit
#

Sorry for being noob - How do i confirm that?

soft girder
#

like a new map is loaded after the initial connection is made

ancient summit
#

Hmm what i want to achieve is a Main menu with server list, which leads to a lobby map which leads to a choosed map

#

I don't care if the lobby will be simple with ready and unready

#

i just can't find a tutorial which is not confusing

soft girder
#

okay keep in mind that online subsystems dont happen in pie. for later on down the road. this is things like xbox steam ect

ancient summit
#

i want to start with lan to learn the multiplayer sub

soft girder
ancient summit
#

Do i need to go back to Normal Session Instead?

soft girder
#

this is what i went by when we set up our lobbies

ancient summit
#

I mean - Advanced Session meant for normal lan to play with my friends at home?

#

it's just for learning the concept

soft girder
#

thats what we use. we have our advanced session set up for lan and online. we have a couple in the house that help test and a couple north a few states that login from ip address

ancient summit
#

i feel like since the moment i switched to advanced sessions the input went wrong

soft girder
#

could be the case but something else i feel is amiss

#

something small fundamental in nature. its so odd that would cause this issue

ancient summit
#

and i was wrong

#

happens on normal session aswell

soft girder
#

i checked and we are not using advanced

#

i think advanced requires it to be used outside of the editor because no subsystem

#

here is how players join in our blueprint

ancient summit
#

Well, after debugging my only thought is that the problem is on the BeginPlay\OnPostLogin

soft girder
#

hey show me how you create the session

ancient summit
#

yeah the problem is not there

soft girder
#

ok

ancient summit
#

session is created and joined well

soft girder
#

the host should be the only one creating a session

ancient summit
#

the problem is when the pawn is created and possessed

soft girder
#

that would mean there is a problem with gamemode

#

did you change the class defaults of gamemode?

#

this

#

go into class settings and see what your parent class is in your gamemode?

#

it should say gamemode. i issue with clients not moving when it was set to gamemode base

ancient summit
#

nope

soft girder
#

damn

#

if you plug in both begin play and post logon does it work?

#

or have you already tried that

#

make sure all this stuff is good as well

#

this is mind boggling my man

#

when clients join are they typing in the IP address?

#

how is that handled

#

i dont think this is your problem but you never know where a solution may come from

#

i hope you figure it out man

#

please let me know if you do

soft girder
#

searched client not possessing pawn in bing and google gave a few results that seem super similar to his issue

near bison
#

Anyone know why this print only works for the host, but the cast fails for other clients?

unkempt tiger
#

~~Inside NetSerializers, for example when serializing a TArray of floats, what do I have to type out to replace this: Ar << FloatsArray with ```
Ar << NumberOfFloats
if (Ar.IsLoading) FloatsArray.Empty(NumberOfFloats)
for (int i = 0; i < NumberOfFloats; i++)
{
Ar << FloatsArray[i]
}

(the intent here^ is obvious, I just want to serialize every float separately so I can also do some logic in that loop, but it's not working - its getting the sending client disconnected)
~~
Edit: got it
normal jacinth
#

I'm stuck on a really silly issue. For some reason the server will also read a vector as 0,0,0 no matter how I try to set the variable. It's on a Run on Server event in PlayerController

#

sorry for truncating your reply @unkempt tiger

#

I've tried replicating the vector, setting it in GameState and replicating it, nothing seems to work, it always reads as 0 on the server

near bison
#

@soft girder lol I have the same issue as @ancient summit
my clients are able to receive inputs now though, when I set my parent class to Game Mode Base

winged badger
#

without reading anything but your last @near bison , id say that you had a combination of GameMode and GameStateBase

#

those aren't meant to work together

#

and as a result your clients never called BeginPlay (called from OnRep_MatchState in GameState under the hood)

#

it should work if you go with GameMode and GameState (no Base part in either of them)

#

@ancient summit guessing i should tag you with this as well

near bison
#

Yup, works!

#

quick question: is beginplay called once for each client (when possessing a pawn?)

winged badger
#

and by "never called BeginPlay" i meant no Actor in client's World called BeginPlay

#

BeginPlay is last part of Actor construction really

#

it has nothing to do with Possessing or Pawns specifically

#

server instantiates an Actor, at the end of its construction process, it calls BeginPlay

#

client receives a message it should spawn a replicated actor, it spawns it in, replicated variables are set, OnReps are called, BeginPlay is called

near bison
#

Anyone know why this print only works for the host, but the cast fails for other clients?
@near bison is there a reasonable explanation to this then?

winged badger
#

relative to Possessing

#

on server, Pawn will call BeginPlay immediately before its Possessed

#

on clients, no Possess is called, but the Controller variable has replicated, so there is a valid controller on BeginPlay

#

welcome to Unreal โค๏ธ

peak sentinel
#

There should be a node something like "On Possess"

#

i also didnt read anything but last btw

winged badger
#

and by there is a valid controlelr on BeginPlay, i am assuming we're talking your local Pawn and your local Controller, otherwise there won't be a Controller at all, at any point

near bison
#

So I have to get playerstate from the controller first?
Or maybe call my player state in the controller itself?

winged badger
#

for what?

near bison
#

ok I'll try to explain what i'm doing:
I enter a name in my main menu (in an input field), when "Create session" is clicked, I set that name in my game instance

since player state doesn't persist across level changes, I set it in game instance.

Now within my new level, I grab the name from game instance and set a variable called "playerName" in my playerstate

#

is this unnecessary? Should I just use gameInstance directly? But then variables in game instance are not replicated, I need the PlayerName variable to be replicated for future use, hence I"m shoving it into playerstate

winged badger
#

your playerstate, after joining a session needs to RPC the PlayerName to its server instance

#

where you keep it, it doesn't really matter, i pull mine from steam client

near bison
winged badger
#

there are more ways then GI to persist data across level transitions

#

yes, PlayerState is perfectly capable of setting its own damn name ๐Ÿ˜„

near bison
#

there are more ways then GI to persist data across level transitions
@winged badger I can't use Seamless Travel in this case. Because I am using Open Level when I create a session. so I guess I can't leverage CopyProperties

winged badger
#

you can, but that would work only for listen server host

near bison
winged badger
#

why is PlayerState not doing that in its own BeginPlay?

near bison
#

Hmm, could try that.

winged badger
#

and also don't just set the Name

#

Server RPC it so all can see it (if client)

#

and set it from the RPC

#

PlayerState is Owned by its PlayerController

#

so it can send and receive RPCs just fine by default

#

also, on server, you will have a PlayerState at BeginPlay

#

on clients, there is no guarantee of that whatsoever

normal jacinth
#

I've narrowed my problem down. I need to make a decision based on a variable stored in GameInstance, which the server doesn't see. What's the best way to pass a variable from GameInstance to the server?

near bison
#

and set it from the RPC
@winged badger set it where?? the player state?

winged badger
#

yes

#

PlayerState is a separate Actor, with lower NetPriority then the PC

near bison
#

Gonna give it a shot ๐Ÿ‘

winged badger
#

work got in the way, PlayerState not being the same Actor means that a reference to the PlayerState and a PlayerState Actor itself both have to replicate in order for client to have a valid PlayerState on its side

#

and that usually doesn't happen by the time controller calls BeginPlay

normal jacinth
#

Can anyone help me with the game instance? I know it's not replicated but the server is completely unable to read variables from it, even when passed from other classes (I've tried game controller, game state and player state)

wicked brook
#

you have to send variable from game instance to server via rpc from like player controller or player state

lapis dew
#

Also have you ever played LA noire?
@echo snow I have not, why do you ask? Also the dating game is a good idea!

echo snow
#

@lapis dew in LA Noire you're a detective and one of the features of the game was the face expressions etc. gave away crimes and stuff.

normal jacinth
#

@wicked brook I'm doing that but it doesn't work

wicked brook
#

post screen shot of event you are using to send it

normal jacinth
#

this always reads as False on the server

#

I tried repnotify, same thing

wicked brook
#

are you using switch has authority? to make sure its executed from the client

normal jacinth
#

yeah I've tried that too

wicked brook
#

have you tried setting it manually not from the passed paramater to see if it gets called and sets it?

normal jacinth
#

yeah

wicked brook
#

so its not getting called?

#

if its not getting called then your cast must be failing. put a print string and check if its failing or not

#

also do you have the game instance class set up in the player settings?

normal jacinth
#

yeah defo

wicked brook
normal jacinth
#

yep

wicked brook
#

and its still failing?

#

or the cast passes and the event just not getting to server?

normal jacinth
#

this is with RepNotify; the client who has True prints True, but the server prints False

thin stratus
#

You seem to be mixing so much stuff

wicked brook
#

yeah i dont think you should use rep notify here

thin stratus
#

Setting a RepNotify variable on Remote only is also wrong

#

That only sets it on that specific client

normal jacinth
#

well that explains that

thin stratus
#

RepNotify is just a replicated Variable

#

It has to be set on the Server

#

You can use a ServerRPC to bring values over to the Server of course.

normal jacinth
#

good to know thanks

thin stratus
#

As long as that ServerRPC is part of a ClientOwner Actor

#

Like PlayerController, PlayerState or a Possessed (Not BeginPlay!) Character

normal jacinth
#

it doesn't work if it's only replicated either, though

thin stratus
#

This should work just fine

#

It will set the Boolean to whatever the GameInstance value of that Player is

#

Obviously only on that PlayerController

wicked brook
#

his cast must be failing if not

#

thats only thing i can see

thin stratus
#

I don't see where and how he is checking the variable

#

Using stuff like GetPlayerController0 could also be the problem

#

Or not realizing that there are more than 1 PlayerController on the Server

#

etc.

#

But yeah, the cast could fail

#

It is also important that the function in the image i Posted is guarded

#

By "IsLocalPlayerController"

#

Otherwise the Server will also call it and set the variable too

normal jacinth
#

by guarded do you mean running only 'on remote'?

thin stratus
#

No

#

Running only on LocalController

#

Server's own PlayerController is a local PlayerController

#

But it would fail the Remote check

normal jacinth
#

how do I guard it then? it's currently running form BeginPlay of player controller

thin stratus
#

Branch + "IsLocalPlayerController"

#

That makes sure that the function only passes locally. The PlayerController of a CLient exists on Server and themselves. So this makes sure only themselves call it.

#

Server PC only exists on the Server. They pass the Branch too for their own PC.

normal jacinth
#

ah ok, i'll try that now then

peak sentinel
#

Branch + "IsLocalPlayerController"
is this something different than "isLocallyControlled"?

thin stratus
#

No, but IsLocallyControlled is the Pawn function

#

It checks if the character is possessed

#

Or rather

#

If there is a valid Controller

#

That fails for all Simulating clients

#

And then checks on the Controller -> IsLocalPlayerController

normal jacinth
thin stratus
#

You can't print directly afterwards

#

That's not how replication works

#

You are performing an RPC

#

That takes time

#

Then the Boolean has to replicate

#

That also takes time

#

That's what OnRep is for

#

The function calls when the values replicates

normal jacinth
#

ah so that's not a good test then

thin stratus
#

A boolean is a bit shitty though

#

Because if it's false and you set it to false, it will not call the OnRep

#

Better use an Enum for that

#

Give it 3 values

#

Invalid, ConsoleOperator, XYZ

#

XYZ is whatever the opposite of a ConsoleOperator is in your game

#

Then if you set it to ConsoleOperator or XYZ, it will both cause OnRep to call, because you change from Invalid to one of them

normal jacinth
#

i think that's worked now, just testing

#

yeah that did it, thank you! ๐Ÿ™‚ I've been stuck on that for 4 hours -_-

ancient summit
#

Can someone tell me why when i host a session, all of the players on the PIE are running as well?

winter stump
#

Hey guys so we tried a bunch of things last night with no success in our issue. In spectate mode mouse movements are truncated and happening in stutter steps . Itโ€™s not being smoothly replicated . Any one have any experience with this ?

#

Here is a video of another individual that had this issue in the past. Same exact thing as us. We have not found the fix

near bison
#

anyone got any idea why my character is not spawning on a client? (multiplayer)
Game mode is inheriting from Game Mode and Game State is inheriting from GameState

thin stratus
#

@winter stump I don't think Camera Rotation is smoothed

#

That's literally just the numbers as they come in

lucid vault
#

I want to update a widget when a player joins the game. Should I just get player controller, call a function PlayerJoined() on that Controller, and update widget from there?

#

I was hoping there would be a simple way to hook into player state changes directly from the widget

thin stratus
#

@near bison Not enough info to be honest. Can be a lot.

#

@lucid vault GetPlayerController is always local. If you want the PlayerController of the joining Player you can use "PostLogin" or "HandleStartingNewPlayer" in the GameMode and perform an RPC on it.

winged badger
#

or you can just add a bit of code and make gamestate broadcast changes in the playerstates

#

or hell, have the playerstates on beginplay find the local controllers hud and say hello

#

(there is practically no difference between those 2 approaches)

winter stump
#

@Cedric โ€˜eXiโ€™ Neukirchen#4538 so is it an update rate issue ?

bitter oriole
#

It's not an issue

#

It's the normal behaviour of replicated data

#

Your client has to account for an update rate that will be very different, and much lower, than its framerate

winter stump
#

so how would we get a smooth spectator for first person . Like many of the competitive FPS games out there like Valorant

bitter oriole
#

Like every multiplayer game does, through interpolation

#

Same way other people's characters appear smooth on your screen, while you're probably running a framerate twice the update rate

peak sentinel
#

i've added the config parameters as the tutorial showed but Steam not enabled on Standalone launch?

lucid vault
#

@winged badger BeginPlay and Destroy inside of PlayerState do seem like a reliable way of notifying classes that people have joined/left.
Instead of calling a function in HUD when a player has joined/left, wouldn't it make sense to create an interface, such as IPlayerGameInfo with functions PlayerJoined() and PlayerLeft(). You could then loop through every actor that implements those interfaces to execute the appropriate function.
That way, any blueprint has the ability to listen for player's joining/leaving. Any downsides to an approach like that?

winged badger
#

EndPlay, not Destroy

#

its more performant to override AddPlayer and RemovePlayer in GS to broadcast a MC delegate

#

and subscribe there

#

then making an entire interface and looping over all actors ont he level

lucid vault
#

Ah, that does make more sense

vale ermine
#

so what you think? Save and load player inventory using Amazon S3 and save game slots? Server will be the only one that can change these files on the S3. When a user gets an item for the first time it will create a .sav file for that item. It will store all information about that item. What slots item is in the inventory, how many of the item are in each stack in the inventory, its name description ect.. When a player uses an item the server will change the .sav file for that item for that user. This will prevent loading and saving big .sav files when only one change is needed.

#

I could even time stamp and assign unique ids to each item as they are created so that i can check for duped items and remove them every maintenance

#

I been all over the place with this and I am just trying to get a sound system in place.

winged badger
#

there is no point saving name, description, etc...

#

its static data

#

can be packaged for clients inside a datatable or a dataasset

#

and it takes far more space then the ID, Slot, StackSize

vale ermine
#

well id will be the name from the data table that is used when creating or casting to that items save file for that item. If user gets item and cast fails create game slot based on user name and id of item. Update location in inventory item was added to or removed from. This all so that I can manage loading player inventory when they log in

#

this way they would have things like usernamefriendslist.sav I could handle match making to

#

say i am building a team during match making. I want to check if user has this this item. Match make with another player that has this item. All I would need to do is cast the itemid player name to their save slot. if cast fails they don't have that item keep looking for a player that does. I could use other tags for sav files like equipped. That way I could match players based on equipped items. The possibilities I see with this are endless.

winged badger
#

none i'd implement would require a Cast tho

vale ermine
#

i have to see if the sav file has been created it if fails i have to create one

winged badger
#

where does the cast come in?

vale ermine
#

Load game from slot

winged badger
#

you have the object, you deserialize the save into it

#

it either succeeded or not

vale ermine
#

see the way i see it if players are inactive for 7 days their .sav files will be cleaned from server. If they log back in after their .sav file are deleted. The server will pull their .sav files from S3

#

any change made will be updated .sav file on server and changed on the S3

#

but that sounds right correct? Any change made in player inventory adding item, using item, moving item ect .... 1: change this on server and save to the .sav file on server. 2:Then save that .sav file to S3. Player loads into instance. Instance retrieves all .sav files for player if these files are not on the server or are not updated. Update could mean I needed to push a change to an item for all players or remove event items from players inventory.

#

would be cool to make a plugin that does all this and has a way to create admins and a cool ui in game to edit and change items for players. I see all this should be possible with the direction I want to go with it.

halcyon totem
#

I am trying to replicate a radar for multiplayer but keep getting errors, I noticed if I added some code that some errors go away but not all. If I add "get controller---> cast to replicated controller" My cast fails and print screens HELLO but I have less errors. I am trying to figure out how to get rid of the errors

#

when I connect this code I still get a cast failed print screen but some errors go away