#multiplayer

1 messages ยท Page 578 of 1

vale ermine
#

use has authority node see if both fail

halcyon totem
#

where should I put the has autority node?

#

and should I put authority or remote?

#

they both still give the same errors

vale ermine
#

well first thing your doing wrong is..Anything that needs to be ran on server should be ran through a custom event and set to run on server.

halcyon totem
#

well its just suppose to be a local radar not for everyone

#

should I still make a custom event and run it on server even if I just need the radar on one class of p layer?

vale ermine
#

and use get player controler not get controler

#

has authority is fine for now tho

#

focus on your cast that needs to be fixed and able to work. Tried using get player controller? instead of get controller?

#

i don't think is supposed to be a pawn

halcyon totem
#

I tried it with get player controller I get the same errors as about with authority connected I get more errors like in my pictures, same ones, if I use remote I get less errors same ones as before

vale ermine
#

are you sure your casting to the right controller? i see a begin play. has the controller even spawned yet when this code is called?

halcyon totem
#

yes I am using replicated player controller for the game

vale ermine
#

if your using the right casting and it fails on server and client. This means your controller object has not been created yet and does not exist. That is why the cast fails

halcyon totem
#

so my replicated player controller is not created ? is that where the problem is?

vale ermine
#

can not replicate if its not even created yet. Is that code for your radar in a widget or hud?

halcyon totem
#

that code is on the character

vale ermine
#

ok then try a delay

#

before the cast

#

like 1 second

#

see if it is because the character just got created. maybe the controller has not spawned yet and possesed the character at that point

#

i mean thats how i think it would work character spawns then controller is spawned and it possess the character. So if you put a cast to the controller like that at begin play maybe thats the issue.

halcyon totem
#

i tried with the delay, both with switch has authority and remote and with out the node, same errors as aboove

vale ermine
#

thats the thing. I cast to my controller from so many places all the time and it works. I have not see one error yet. This could lead us to the problem. should say access none

halcyon totem
#

it says access none for the radar widget

#

im just confused as to connecting it one way, makes some errors go away, shoud I try a custome event?

vale ermine
#

no has authority will do same thing go one way if server go other way if client. All you need to do is make changes on server and the changes replicate to the client if you have them set to replicate

#

so yea everything should go through custom events ran on the server. Why? Because that is where all your objects exist. They do not exist on client. Client is just a window into what is going on on the server.

#

you want access to a controller? you need to access and make changes to it on the server

#

can do this with custom event then set to run on server ๐Ÿ™‚

#

for your issue here is how I would tackle it. on server have a function custom event named update radar.

#

Put this in your controller

#

set up a timer by event

#

set the timer to the amount of time you want inbetween radar updates

#

build the array of objects that will show up on the players radar

#

because the custom event was ran on server and it was in the player controller the array of objects that need to show on the clients map will be replicated to the client.

#

all the client code is to read what that array of objects is and it should know how to display them on the radar

halcyon totem
#

Im going to try putting all the radar code in the player controller, and see if it fixes the issue

vale ermine
#

so think this way make change to server use those changes that are replicated to client to display what you want the client to see

halcyon totem
#

im need a smoke break lets see if moving the code over will fix my issue

vale ermine
#

kk

soft girder
#

@winged badger @ancient summit @near bison I'm at work now. I slept through most of those messages. I noticed zlo said something about gamemode and gamestate base. Is it the combination that matters? I want both bases or both non base?

winged badger
#

yes

#

for multiplayer, you really want both non-base

soft girder
#

Thank you for the clarification.

#

I remember making that mistake a long time ago

winged badger
#

it gives you control over match start

soft girder
#

I forgot about the gamestate having to match.

#

I had elenby exact issue till I change them both to non base

winged badger
#

its more or less standard practice to prevent match start until all players have loaded after seamless travel

soft girder
#

I picked gamemode so I could do a warm up phase

#

Ya

winged badger
#

also

#

GameState, as opposed to GameStateBase provides one very convenient network guarantee

#

GameState Actor will have replicated before any of Client Actors call BeginPlay

soft girder
#

That's very nice to know

winged badger
#

as its replication is what starts BeginPlay on Client's World

#

can't be any other way

soft girder
#

Thank you dude. This actually became a bit of crucial info for myself

vale ermine
#

Think about it when you finally release your first game and all that working code you get to reuse.

soft girder
#

Lol

winged badger
#

i wrote the codebase modular, good practices, minimal coupling, draconic encapsulation

#

i would still need to clean up and refactor for about 4-6 months

vale ermine
#

that does not sound fun

winged badger
#

before its really reusable out of the box

vale ermine
#

why use a system that can not be reused?

winged badger
#

i have deadlines, i can't rewrite systems whenever i like

soft girder
#

Can I ask your opinions on the differences between abstraction and encapsulation?

winged badger
#

so some organic growth is inevitable

soft girder
#

To me it's a big grey area in definition

vale ermine
#

i see I guess that is the benefit of having your own studio no deadline

winged badger
#

abstraction exists to minimize coupling/dependencies

soft girder
#

Removal of unnecessary details

vale ermine
#

well that would be good for cross platform

winged badger
#

encapsulation is more of a forcing all the code through one "legitimate" path only, which reduces the potential for bugs, and makes maintenance easier

soft girder
#

Mattxor you run your own show?

#

That's about the same def I've heard other places. Yours is more clear tho

vale ermine
#

well i have a business partner we are 50/50 but he does not work well with others

winged badger
#

was proud when one of our programmers rejoined the project and everything exploded in his face whenever he tried to take a hacky shortcut

soft girder
#

More concise of a definition

vale ermine
#

he is still working on the same game from 2 years ago

soft girder
#

Lol

vale ermine
#

i have released 2 games

soft girder
#

I'm trying to get the blending and animations down

vale ermine
#

yet he dont want me to lead says he dont like being told what to do

#

i swear he is a child

soft girder
#

We didnt use any free assets and are 4 months in on this new rebuilt version with out animations still lol

vale ermine
#

good advice never get a business partner lol

soft girder
#

You have to lead sometimes

#

Human nature to just stare at youtube for 8 hours

#

Lol

vale ermine
#

The thing is I am the programmer so I would be the worst asset to lose haha

ruby rock
#

@winged badger - from a software engineering point of view have you used / considered using test frameworks (C++)? Just wondering I don't hear much about them in the Gaming world

soft girder
#

Ya my guys and girls hate mr. I wanted to be the artist and idea guy and ended up being the programmer lol

vale ermine
#

Zlo speaks a foreign language to me

#

I hope I will be on that level some day

soft girder
#

Not very good at it but after a year and half of experience my stuff works now lol

vale ermine
#

well the whole Idea around object oriented programming is the best thing in the world. I am happy to be here for it.

winged badger
#

@ruby rock never got around to it, altho 3 years into the project i think it would had saved me some headaches if i did

vale ermine
#

Thats the bad thing too. These guys like Zlo get stuck when they could be able to do so much more. But at the end of the day it comes down to $ ๐Ÿ˜›

soft girder
#

Can knowing ue4 fairly well actually get you a job tho?

plucky sigil
#

How can you achieve team based visibility in a multiplayer environment

soft girder
#

What do you mean?

#

Like a arrow above their head based on a team variable?

plucky sigil
#

A team is made up on players
There are numerous teams
Only certain teams can see certain teams

soft girder
#

Check if team = team

vale ermine
#

Why would you want a job doing ue4. You want to get stuck doing what Zlo is doing and have no room to grow.

soft girder
#

On item begin play if team is not equal set to non visible

vale ermine
#

JekasG use actor tags

plucky sigil
#

Will it just not render ? What about collisions ?

#

Isnt actor tags expensive in a multiplayer game

soft girder
#

You would have to set that as well

#

Or on the collision end do the check there

vale ermine
#

depends on how many people

soft girder
#

What do you mean by actor tags

plucky sigil
#

That SetVisible is global right ?
I want certain people see me and certain to not see me

vale ermine
#

well the way my targeting system is set up is based on tags

#

it gets all actors with tag and attacks closest one. But it could be used for the teams to figure out who sees who

plucky sigil
#

Is it expensive

#

What if theres 50-100 players

vale ermine
#

an array of 100 is nothing if it has to do it only one time on initial setup

plucky sigil
#

What if it changes at runtime

vale ermine
#

you can delete and add tag to actors they could switch teams if you want

plucky sigil
#

Wait how would you way work ?

#

Would it mean

#

Having multiple meshes

vale ermine
#

all your damg will be based on tags

#

you could have tags for components too

winged badger
#

you could mostly be overriding IsNetRelevantFor

plucky sigil
#

So SetVisible would be local for each player ?

winged badger
#

to check the TeamID for the controller

#

or set it up via ReplicationGraph, team Buckets

#

if you're BP only, you just might be out of luck

plucky sigil
#

Im C++

winged badger
#

team interface on the PCs

plucky sigil
#

Theres TeamInterface class

#

?

winged badger
#

Cast the RealViewer to the interface in IsNetRelevantFor

#

compare TeamIDs

#

and force it to return true if the TeamIDs match

plucky sigil
#

Is it a hack

winged badger
#

if not, then do whatever condition fits best

#

with normal relevancy, no

#

its the way to do it

plucky sigil
#

Do i also use SetVisible ?

winged badger
#

replication graph would probably be more sofisticated here

#

no, non-relavant actors don't actually exist on clients, unless they are static

#

they get destroyed when not relevant and spawned again when they become relevant again

plucky sigil
#

Im actually confused

#

What function do i use to control visibility

winged badger
#

you don't

vale ermine
#

thats the thing its in c++

#

so my question is can you change it at runtime

winged badger
#

the dynamically spawned actors that IsNetRelevantFor returns false

plucky sigil
#

Yes, it changes at runtime

winged badger
#

will get destroyed on the clients for which it is false

plucky sigil
#

I see

winged badger
#

so they will be invisible by the grace of not existing to start iwth

plucky sigil
#

Is this a tick function ?

winged badger
#

not quite

#

NetDriver evaluates Actors for replication, but has a cap on how much time it can spent doing that

#

if your network is completely unburdened, it will be the NetUpdateFrequency, how often they get evaluated

vale ermine
#

well that don't sound good if you need it to be instant

winged badger
#

you can ForceNetUpdate

plucky sigil
#

OOF

winged badger
#

but best not to abuse that

vale ermine
#

oh nice

winged badger
#

ForceNetUpdate is for GameplayCritical changes

#

and for actors that have super slow NetUpdate intervals

vale ermine
#

its pretty critical if another actor needs to be relevent

winged badger
#

like, actor needs to update once in 20 seconds, so you might as well drop net update frequency to 0,1 or so to let your net driver breathe, but forcenetupdate when the change comes

vale ermine
#

say a cloaking skill?

plucky sigil
#

So basically IsNetRelevantFor should handle everything for me as long as i return the right value
It should "hide/unhide" players that arent of the same team

vale ermine
#

but its not hide it don't exist?

winged badger
#

@plucky sigil replication graph might be more suitable for a team RTS

#

as you can easily setup shared vision and such

#

IsNetRelevantFor would make that... problematic

plucky sigil
#

How do i use Replication graph

vale ermine
#

IsNetRelevantFor is the only way I see a cloaking skill. If the actor is not relevant on the client they can not cheat and uncloak the actor because it is not being replicated to the client correct?

winged badger
#

yes, the problem is if you have a shitty or intermittent connection

#

because you will need that Actor back really fast when it drops the cloak

vale ermine
#

Thank you for clarifying because I will need this some day

#

There must be a way to fake the client. Maybe spawn a pawn for the cloaked player that will take over until the actor is relevant again

plucky sigil
#

@winged badger If you switch to using replication graphs will your existing networking stuff be broken ?

plucky sigil
#

Is it worth using replicated graphs if your game isnt that big. I mean how big should it be?

bitter oriole
#

It was made for Fortnite

meager fable
#

apparently kicking the player takes some time to do

#

how can i make sure that everyone update gets called only after the player is kicked?

light cloud
#

To make a coop game does it have to be on steam if I ma using unreal engine? or can I set it to be something like through some custom server? Like how is the server system work in unreal

soft girder
#

@meager fable check if it is valid

#

Might be dumb but I would check is valid on the player controller kicked. On true just loop back until it is false. Once it is no longer valid could do update then

meager fable
#

yeah i tried doing so but it threw an error that an infinite loop is detected

#

so i just put a 1 sec delay

#

and it works

soft girder
#

Cool

#

Prob a cleaner way to do that

meager fable
#

yeah that's what I think too, I just dont see it yet

soft girder
#

@light cloud can set it up to dial an ip address. Just if that address changes you would need a game update to change it. Need something consistent to avoid down time. I think I seen a tutorial on using amazon web services

#

Our game just has a dialer right now. We type in the ip address and port number. If no connection happens it times out and returns to menu. If connection happens it shows a load screen while they wait to load the session

#

I wouldnt release like that tho

#

I'd set it up to use steam online sub system at the very least so they could connect through friends list and all that good stuff

#

I think setting up a dedicated server requires some c++ tho

light cloud
#

Thx @soft girder for the fast response, I will watch some tutorials about that, but if a server is on spesific IP and port doesn't it need to be on like some sort of a storage?

soft girder
#

Not sure what you mean by storage

light cloud
#

you know, some games has server storage which they can click "create server"

#

it saved in their storage no?

#

I am new to the multiplayer systems

soft girder
#

It creates the session then if you set it up like that. If your talking about saving save data I think @vale ermine was talking about dynamodb last night

#

I would focus on learning p2p networking and the listen server way of doing things first.

#

Like one player is the host type of setup

ruby rock
#

If I had a variable in PlayerState (call it Health), and I wanted to use RepNotify to setup a reaction to that variable in the Character or PlayerController - how would you go about that? (Thinking is to update a progress bar widget)

upbeat basin
#

Hey all, is there anyone who used OverrideWith event on PlayerState that can help me? I'm working on my reconnection case and having some issues, the variables I get from the returned PlayerState has default values instead the old ones

soft girder
#

repnotify could call a function in the owners widget

#

do something

#

but i believe the progress bar is bindable to a value

ruby rock
#

You'd want to avoid binding for performance though yeah?

#

(My understanding is that it effectively ticks waiting for updates)

#

function in the owners widget
You meaning doing something like get owner pawn -> cast -> get hud -> get widget -> update?

#

I was thinking to maybe use an Event Dispatcher - but can't seem to make it work on clients..

soft girder
#

i feel like that performance loss for a widget would be minimal

#

if your ticking the shit out of something somewhere else that you cant let go of by all means just update it onRep

#

small operations on tick are ok

#

i know tick is the devil

#

but the devil is in the details here so to speak

#

depends on what your doing

#

i do alot of shit on tick

#

the little screen at the bottom is like a digital scope

#

the name inside comes from the result of a sphere trace that is happening on tick while this scope is valid.

#

i didnt lose a single frame from doing it this way so far

#

maybe when we build the final version i will have a better way i hope

#

but as long as the operation is small tick wont hurt.

#

now if you got a crap ton of actors ticking (which tick by default) then that would be bad. its best to disable tick on each blueprint that you dont use it. this could save alot

ruby rock
#

ok, so can I phrase this a little differently.

#

If you had a gamestate variable, call it Score for instance

#

And you wanted to detect when a player got their Score past say 50. You'd want some custom event to fire

#

I think I just answered my own question ๐Ÿ™‚

soft girder
#

i think you know what to do

royal rampart
#

hey guys, i can't seem to pass an array in a RPC function, the array size is allways null for the server

#

it is an array of pointers of a class I made that derives from UObjects

bitter oriole
#

Are the UObjects replicated ?

#

Well, they aren't I guess since UObject doesn't provide that

royal rampart
#

wait ill make you some snippets ๐Ÿ˜‰

#

this runs in the gamemode (so stricly server)

#

but has to pass this to the client (serverside)

bitter oriole
#

UPlayerServerInfo needs to be replicated, that is, these objects need to also live on the client

#

The likely fix here is to make that class an USTRUCT instead

royal rampart
#

but but but, that fucks everything up ๐Ÿ˜ฆ

#

so the server can't manage UObjects?

bitter oriole
#

UObjects are heavy objects that aren't passed as copy ever - they are in fact, non copiable. The logical follow-up of that is that UObject RPCs only replicate the pointer, and clients/server need to have that UObject existing already. So you're really passing a pointer, not a copy.

#

This would work if these UObjects are replicated

#

But UObject doesn't do that, out of the box

royal rampart
#

yeah okay, makes sense

bitter oriole
#

Actor/component do

royal rampart
#

but can I pass them as a object then, not pointers?

bitter oriole
#

Structures are however passed by copy, and support replication with USTRUCT + UPROPERTY

#

So that's the simpler approach

#

But it's obviously fundamentally different

royal rampart
#

so I shouldn't copy those UObjects to the server

#

but the thing is, I need that playerserverinfo to communicate with a entrywidget for a listview widget, and the only input you can give is a UObject ๐Ÿ˜ฆ

bitter oriole
#

Replicating widgets is likely a mistake too

#

They should be entirely client-side

royal rampart
#

nono i dont replicate the widget, i just need to pass the info from the server to the clients, and the clients themselves add the list items

#

but the only thing the clients can call on a UListView is AddItem(UObject* object);

bitter oriole
#

The short answer is that you should make it a structure, and have your widgets use that structure to then do AddItem() with a new client-side object

royal rampart
#

that's why i made a class deriving from UObject

#

but will I be able to pass an array of structs from the server to the clients?

bitter oriole
#

Yes

royal rampart
#

thanks for your help btw, I realy appreciate it!!

#

okay, so just create the same class but as a struct instead

#

but does a STRUCT derive from UObject? because i need to pass it with the listview function

bitter oriole
#

No, structure are basic types

#

Your UI code will need to create or manipulate an UObject based on the data in the structure

royal rampart
#

oh okay okay I get it

bitter oriole
#

Basically you have two mechanisms for networking in UE4, and two target objects

  • replication (server copies data to client(s) ) vs RPC (client/server copies data to client(s)/server)
  • UObject (can't be copied, is garbage collected, has to implement replication for anything network related) vs basic types (can be copied, can be used for replication/RPC with no effort)
royal rampart
#

so I could just pass the structs, and then in the client, make it a UObject

#

to pass it to the listview widget ๐Ÿ™‚

#

and do I pass the array of structs by reference? no right?

bitter oriole
#

Doesn't matter, but reference works fine

royal rampart
#

but not pointers right?

bitter oriole
#

Yeah, pointers to basic types can't be replicated

royal rampart
#

okay perfect!! ๐Ÿ˜„

bitter oriole
#

Basically UObject is pointer only, and the rest is anything but pointers

royal rampart
#

thank you, ill implement it now

bitter oriole
#

(including shared ptrs etc as pointers here)

near bison
#

Does it make sense to set a repNotify on a playerState variable?

#

I'm trying to repNotify my playerName

winged badger
#

it does, if your Players have to RPC their name to the server first

near bison
winged badger
#

unless you delay UI init by a lot, odds are not all PlayerNames will have replicated

near bison
#

What would I have to do next to ensure all clients see everyone's names correctly

#

I'm guessing in the OnRep_PlayerName I'd have to set the textRender for the player?

winged badger
#

i had that very conversation last night

near bison
#

Could you briefly explain what delegating means in this context

#

and bind to another delegate that you add to PlayerState broadcast when the name is changed ?

winged badger
#

PlayerState add a delegate (Event Dispatcher for BP)

#

and broadcasts/calls it from OnRep_PlayerName

#

notifying any UI and other object that might be interested in the PlayerName, but has accessed the PlayerState's PlayerName before it replicated, that the Name arrived

near bison
#

pardon me for drawing parallels here, but for my understanding:
it's like event listeners for the web?

#

and the event in this case is the repNotify of the playername variable?

winged badger
#

event listener is for example a UMG widget thats supposed to display that Player

#

when its constructed its given a reference to specific PS

#

by whatever constructed it

#

then it tries to SetText for the PlayerName

#

however there is no guarantee that the PlayerName is good at this point (if your Players have to server RPC their names at BeginPlay)

#

so, just in case it isn't, the widget binds to a delegate in the PS to get notified when the name changes

#

instead of repeatedly checking

near bison
#

Ok yeah, I get the basic idea

plucky sigil
#

@winged badger Im still having issue with the team based visibility

near bison
#

@winged badger so just to be clear

  1. I create an event dispatcher for my widget (in this case, my TextRender for character). This event probably takes an argument like playerName
  2. I have a repNotify for my playerNickname. in the OnRep_PlayerNickname call, I call the event dispatcher for that widget, and I pass the playerNickname
  3. SetText will be called in the event dispatcher

Something like this??

winged badger
#

you create the dispatcher in your playerstate

#

widget just binds to it

near bison
#

by bind, you mean in my widget's beginPlay I call the event dispatcher right?

winged badger
#

where did you find a BeginPlay on a widget?

near bison
#

I mean BeginPlay on my character**
The TextRender is in my Character blueprint

winged badger
#

you bind to it, not call it, like in the screen

#

you also immediately try to set the Name

#

just in case it arrived already

near bison
#

What's the event dispatcher supposed to do now? Because I'm not getting the PlayerName from the character BP, I'm getting it from the playerstate itself

#

So I'm guessing the eventDispatcher will be responsible for setting the text on the character's TextRender now.

winged badger
#

@near bison you're mixing up your terms fairly bad

#

so i have no idea what you're on about half the time

#

i suggest a trip to documentation on delegates/event dispatchers

bronze arch
#

hi folks, what is this gameplaydebuggercategoryreplicator
and how i can remove that?

near bison
#

Isn't event dispatcher just a listener?

#

If On XYZ is considered an event dispatcher, then it is just an event listener.

royal rampart
#

hey guys, would you have any idea if a TArray of structs can replicate to the client side automatically??

#

this is the array, and im setting it server side, but the client local side doesnt get a updated array with the right values ๐Ÿ˜ฆ

bitter oriole
#

Is FPlayerINFO an USTRUCT with UPROPERTY on all relevant fields ?

royal rampart
#

the struct is super simple

#

no UObjects in there

bitter oriole
#

Is the object owning m_PlayersServerInfo replicated ?

royal rampart
#

well that's the pawn, so yeah?

bitter oriole
#

Then if this compiled correctly, and the pawn is created on server, it should work

royal rampart
#

but is doesnt haha

#

wait ill take another snippet

#

this function get called by the gamemode

#

so for all players it updates the array serverside, but not client-side ๐Ÿ˜ฆ

#

even tho m_PlayersServerInfo is a Replicated array

bitter oriole
#

How sure are you that it doesn't update client side ? How did you confirm that ?

royal rampart
#

it should contain an item (client side), but only does serverside

bitter oriole
#

How did you make sure to call this code after the array had time to replicate ?

royal rampart
#

hmmmm interestingggg hahaha

#

can I make sure it finishes before calling updateplayerslist?

bitter oriole
#

No, you can't

#

Welcome to multiplayer

royal rampart
#

but it is only 1 player? so it should be pretty instant no?

bitter oriole
#

Nah

royal rampart
#

im testing with one item in the array now

bitter oriole
#

Here is the only assumption you are allowed to make about multiplayer timings : "Reliable" RPCs will fire in the order they were sent

#

It ain't much

#

Other things you should assume to have random timings

royal rampart
#

so like i should update the playerlist every 2 seconds or something xD

bitter oriole
#

Replication in particular has bandwidth limits, priorities, etc - nothing about it should ever be assumed, other than at some point, the clients will catch up witn the data

#

Let's assume you are displaying a list of stuff on clients

#

Your list can update in the replication event for the array

#

(ReplicatedUsing)

plucky sigil
#

Anyone know how to create teams in a multiplayer environment where players of the same team are visible only amongst themselves ?

bronze arch
#

does anyone dont know about gameplaydebuggercategoryreplicator ? pepehands

royal rampart
#

does anyone dont know about gameplaydebuggercategoryreplicator ? :pepehands:
@bronze arch nope haha

bronze arch
royal rampart
#

Thanks a lot @bitter oriole, I'll try checking the list every 2 seconds for a update

#

i hope it's just because the array is not done replicating

bitter oriole
#

Just use the event

royal rampart
#

because i have been looking for 2 hours

#

what is the event?

bitter oriole
royal rampart
#

replicatedusing?

#

sorry man, im a noob

#

that's something you put there right?

bitter oriole
#

It's alright

#

Yeah, it replaces Replicated

royal rampart
#

and I just have to put replicateusing? that's it?

bitter oriole
#

Wait a sec

royal rampart
#

kk :))

bitter oriole
#
virtual void OnStuffReplicated();

UPROPERY(ReplicatedUsing = OnStuffReplicated)
T Stuff;```
royal rampart
#

sooo... onstuffreplicated will get called if the T Stuff is done replicating?

bitter oriole
#

Every time it's updated on the client (not the server, in C++, IIRC), OnStuffReplicated will be called

royal rampart
#

so it gets called at the start of replication, not at the end?

#

so i'd still have to add some delay or somethin?

bitter oriole
#

It will be called, on clients, every time a new update has been written from the server.

royal rampart
#

okay okay, ill try it now

#

๐Ÿ˜„

bitter oriole
#

For the record this stuff is why multiplayer is not a great idea to start game development

#

Massie learning curve here

lucid vault
#

There is this annoying glitch I've noticed in 4.25.3. My PlayerStateClass keeps getting set to None, and it has wasted so much of my time ๐Ÿ˜†

kindred widget
#

Can't say I've ever had that happen. Have started quite a few different test projects on 4.25.3.

royal rampart
#

@bitter oriole It works! ๐Ÿ˜„ but not if i add multiple clients hahaha

#

i think the server is not getting the actor reference properly

#

can i just pass this in a RPC function?

bitter oriole
#

Sorry I have no diea what you're saying here

#

What doesn't work, what are you doing

royal rampart
#

well in short, a pawn gets created, in his beginplay() (fully client-side), he creates his serverinfo, then passes a reference of himself + his serverinfo to the server

#

there, the gamemodeclass (server-side) needs to add him to a Tarray of players + add his serverinfo to another Tarray of serverinfos

bitter oriole
#

Having the pawn beginplay RPC the server is problematic

#

In order for RPC to be possible, the actor needs to be owned by the local player

#

For a pawn that means possessed

#

Not sure that happens before BeginPlay

twin juniper
#

How do you guys deal with an array that gets disordered? Whats the method to keep the list ordered?

royal rampart
#

std::order

#

xD haha no sorry idk

near bison
#

@twin juniper need more context

bitter oriole
#

@twin juniper Array.Sort(someLambda)

twin juniper
#

Its an array of player ids that i require to keep ordered and it remains such even on seamless travel.

royal rampart
#

Not sure that happens before BeginPlay
@bitter oriole I should use postlogin right? xD

near bison
#

A sort may not be necessary depending on the context. If you have frequent insertions, you can just insert at the right place and it will be O(n) ordered all the time

#

@twin juniper does the order change on seamless travel? I'm not aware

royal rampart
#

@twin juniper you just need an ordered set no? TSet exist I think?

twin juniper
#

Yes it tries to remain ordered but idk ue4 does some weird shit where the list gets disordered and people id will be moved up ahead of others i think its some like latency thing idk.

near bison
#

One more important question: is this an array of structs/objects?
If it is, maybe you can tag along an additional property to the struct/object so then you can sort by that property

bitter oriole
#

@royal rampart I'm just not sure you want that RPC from the client at all. The server should have all the required data already.

royal rampart
#

okay okay ill restructure the whole thing

lucid vault
#

MatchState in AGameMode doesn't have a delegate. I would need custom StartMatch/EndMatch/RestartGame functions with delegates for each. Doesn't it defeat the purpose of these built in states when I have to create my own Start/End/Restart functions anyway? I don't see the usefulness of these built in states

winged badger
#

i don't see a need to broadcast that at all

#

especially start match

#

which every actor responds to already

lucid vault
#

For instance, I have a blueprint door that needs to open when the match begins

#

To allow players to exit their spawn area

winged badger
#

hint: BeginPlay

lucid vault
#

Players spawn in a room, and once every player has readied up, StartMatch gets called

#

Then the door needs to open

winged badger
#

and?

lucid vault
#

It won't happen on begin play

winged badger
#

StartMatch calls DispatchBeginPlay

#

which calls BeginPlay on every Actor in the World

#

so, BeginPlay ๐Ÿ˜›

lucid vault
#

Interesting. I've always thought of begin play as a function that runs after the constructor

winged badger
#

it does

bitter oriole
#

Just not quickly after.

winged badger
#

if the world already BeganPlay

#

if not, it "waits" for the world

#

(in other words, waits for StartMatch)

#

its all white on black in the source code ๐Ÿ˜›

lucid vault
#

I see. So the reason BeginPlay is running is because my match is already InProgress. I guess StartMatch gets called automatically somewhere. I'l need to prevent that in my subclass and call it manually

winged badger
#

GameMode can prevent match from starting

plucky sigil
#

Is there something wrong with this code ? Its not translucent

bitter oriole
#

That's not how you create materials

#

You should create a new translucent material in the content browser, expose a UMaterial UPROPERTY in your actor, set the material in Blueprint

#

And you can then create a new dynamic instance to drive parameters on

royal rampart
#

@plucky sigil what font is that, that looks awesome!

lucid vault
#

@royal rampart He's using Rider if I'm not mistaken

royal rampart
#

hmm can't find rider @lucid vault haha

lucid vault
#

It's an IDE

near bison
#

its an ide

plucky sigil
#

Jetbrains Mono

near bison
#

i wish rider came fo free ๐Ÿ˜ฆ is it free for students?

lucid vault
#

I'm using it for free

plucky sigil
#

It's free

#

Because of the open beta ?

near bison
#

will it go paid later?

#

it says 30 day free trial

plucky sigil
#

Nop

royal rampart
#

wait so rider is something like visual studio right? same same but different?

plucky sigil
royal rampart
#

with a cool font? o_0

#

hahah

plucky sigil
#

Early preview

royal rampart
#

cool

#

i have VA

plucky sigil
#

Not as fast as rider

royal rampart
#

that's all ๐Ÿ˜ฆ

near bison
#

VA is not free

royal rampart
#

yeah but as a student only 50 $

#

kinda worth it

#

but VA doesnt have cool fonts

#

haha

#

i just want that font man, looks so good

near bison
#
Yes! Rider for Unreal Engine will be an official part of our JetBrains Rider IDE, which we see as our main offering for game developers.
lucid vault
#

Delaying the start of the game won't work smoothly for me, because I want my players to spawn as a character in a room, and once they are all readied up, they keep their current pawns. If you delay the start of the game, the players will not receive pawns until the game has started. Even if you manually assign them pawns, they will get reset when the match starts.

I can either modify the functionality of spawning pawns to make it work, or I could just have a sub-state for InProgress called ProgressState. However, BeginPlay will not get called by the sub-state, so I will be required to create a delegate for actors that want to be notified, OnProgressStateChanged.

#

Honestly, the latter sounds like an easier solution. Has anyone implemented something similar?

hazy spear
#

Hey guys: You sure know what I need to do to succesfully package and build my project using the Advanced Sessions and Advanced Steam Sessions Plugins by Joshua Statzer, right?
When I build it the build ends succesfully but when I start the exe nothing happens. In the logs it says
LogInit: Display: Project file not found: ../../../SpaceAdventure/SpaceAdventure.uproject
and
LogPluginManager: Error: Unable to load plugin 'SteamShared'. Aborting.
I already tried the trick with generating an empty C++ class, which opens a dialodue asking if I want to make my uproject file writeable. But after I do that Unreal tells me some modules need to be rebuild and when I click okay that process fails saying it can not find the module with the name of my project. Someone suggested right clicking the blue uproject file and choosing "Genereate VS project file" but that doesnt work either as I dont have any C++ source files in my project (which makes sense as Im using blueprint)
Im sure Im not the first one to have issues with this, so if someone knows a good resource where the building process is explained Id be very thankful

regal relic
#

@hazy spear The advanced steam sessions plugin would require the steam API be installed and configured correctly. You should look into setting up your project for steam support. Allar did a write up way back in 16' with the necessary changes https://allarsblog.com/2016/02/26/basicsteamintegration/

hazy spear
#

Thanks @regal relic ! Ill look into it

gilded thunder
#

anyone have extensive experience with custom character movement components in C++? I'm using custom compressed flags to trigger some movements over network (sprinting, sliding, wall running, etc.) and i keep getting this warning in the output log whenever i play on the client: LogProperty: Warning: Native NetSerialize StructProperty /Script/Engine.Character:ServerMoveDualNoBase:InAccel0 (ScriptStruct /Script/Engine.Vector_NetQuantize10) failed.

near bison
#

Anyone having any issues with Advanced Sessions plugin recently? Create Session (OSS) is working on Standalone, but in my packaged game, create session doesn't work

#

On further inspection, my cast to GameInstance is failing in the UMG widget, when I click on the button to create a session
Why is my cast failing only on a packaged game?

brazen totem
#

Is there something specific you have to do in steamworks to get your app ID to work? I can get 480 or ids of games I own to work but not my own. It also says my account should automatically get license for it but when checking in steam dev console it says I dont have it

lucid vault
#

Why doesn't RestartGame() work for clients in PIE?

twin juniper
#

Hey solias what net driver are you using?

normal jacinth
#

Hi, I'm trying to pass references of everyone's PlayerController from the Server's GameInstance down to a client's UI widget. I'm passing it through GameState and PlayerController and finally the widget, but while the array makes it there, the data isn't right. Is there a better method for this?

bitter oriole
#

Player controllers cannot be replicated to clients

#

What you actually want is for the data you need to be in PlayerState

#

Which is replicated to clients

#

And then the client widget can just read that directly

#

No work required

normal jacinth
#

ah i see

#

so how do clients access each other's player states?

heady python
#

What is the 'User Index' for and should I be concerned with it making a Multiplayer PC game?

bitter oriole
#

@normal jacinth Iterate on PlayerState actors, or get a PlayerState from a pawn

normal jacinth
#

oh awesome, i'll give a go thanks

normal jacinth
#

I'm struggling a bit. I need the position of the other players, in a widget. I've only got it working by setting a reference to the PlayerCharacters On Tick, which is awful. Is there a better way?

tepid prawn
#

How do you guys integrate libuv to this engine? I'm starting to lose my hair when it comes to third party...

sweet robin
#

I'm having some trouble. I'm trying to just display a player's name over their head and it's turning out to be more complex than I anticipated. I can't find the right time to get the information. I'm trying to access the PlayerState to get the player's name. Is a PlayerState created by the server then replicated? Or does a client create their own copies of all of the PlayerStates then wait for those properties to be replicated?

heady python
#

Does gameinstance spawn for every player in a lobby? Or is it 1 per game?

fossil spoke
#

1 GameInstance exists for every player on their own Machine.

#

Imagine the GameInstance as the actual process for the game running on your machine.

plucky sigil
#

How do i disable the spawn of a playercontroller/actor if you're the server

fossil spoke
#

You cannot stop PlayerControllers from being created.

slim matrix
#

why cant clients widgets send Replicated fuctions to other actors wich mean i cant make my clients be able to interact with anything through UI

winged badger
#

replicating UI would be... more then a little complicated

#

and impossible in blueprint

#

in comparison, calling an RPC event on an owned Actor is super simple

slim matrix
#

my widget canm call an rpc of its owner ctor but anyother actor and it dose nothing but idk how then i would be able to make my players widget get a npc/other actor the players interacting with

fossil spoke
#

Would the only cost to replicating 2 uint16s over a single combined uint32 just be the fact the Server has to check 2 individual values for a change in value?

#

There would be no bandwidth benefit to combining into a single uint32?

rich ridge
#

@fossil spoke GAS uses bulk RPC .. so basically you can combine two RPC into one.

fossil spoke
#

That doesnt answer my question.

vale ermine
#

@slim matrix so you want 2 players to interact within the same container ui. like trading?

#

if you want a good multi player ui system the Action Rpg Inventory system on the market is set up for multi player. You would be able to see how the two players can open the same container and move items around and see the changes on both clients

winged badger
#

@fossil spoke only reason i'd ever combine them is if they were... atomic

slim matrix
#

should i also use BP inerfaces

vale ermine
#

yea that is how they do it

winged badger
#

and i wanted to handle replication callback for both of them, having access to both of them inside one function

fossil spoke
#

Yeah so no other benefit other than that.

#

I figured as much.

winged badger
#

only if those were 2 related non-exclusive states

#

otherwise even if you had minimal gains its not worth obfuscating the code for (and you would on average spend more bandwidth, since you would have to replicate the full 4 bytes whenever any one of them changes)

fossil spoke
#

Yeah for sure.

near bison
#

@twin juniper thanks but I fixed it.
The cast to game instance was indeed failing in the packaged game.

The path to game instance in DefaultEngine.ini was wrong (not sure why this reflected only in a packaged game though)

twin juniper
#

Does anyone have a config setup for how they are using steamsockets netdriverdefinitions in their engine.ini?

upbeat basin
#

Hey all, is there anyone who used OverrideWith event on PlayerState that can help me? I'm working on my reconnection case and having some issues, the variables I get from the returned PlayerState has default values instead the old ones

upbeat basin
#

Okay I guess I found my problem about OverrideWith, I wasn't firing the OnLogout event to register my old playerstate in inactive playerstate array. So it was giving me a brand new playerstate. Now my question is how can I simulate logout case on PIE

royal rampart
#

hey guys, would you have any idea why my game would crash with multiple clients??

#

the log says READ ACCESS VIOLATION, but I have no idea where it's coming from ๐Ÿ˜ฆ

bitter oriole
#

Debug it

royal rampart
#

basically, I'm trying to send playerinfo (name + isready(bool)) to the gamemode when the game starts

#

im doing that from beginplay

#

hey stranger ๐Ÿ™‚

#

you already told me that it shouldnt come from beginplay haha

bitter oriole
#

If you have a crash, every time, your answer is to run from VS and get told by VS where the crash is

royal rampart
#

but if I do it in postlogin (from the gamemode) same problem, I think the character is not fully initialized at postlogin

#

If you have a crash, every time, your answer is to run from VS and get told by VS where the crash is
@bitter oriole I don't even know yet how to debug unreal in VS haha

#

ill look it up

bitter oriole
#

Press F5 in VS, basically

royal rampart
#

on development editor?

#

or debuggame editor?

bitter oriole
#

Don't change anything, just press F5, literally

royal rampart
#

okay thanks ๐Ÿ™‚

#

hahaha that launched my editor a second time

#

i need to set the configuration to debuggame i think

bitter oriole
#

No, you do not

#

Just play now

royal rampart
#

ooooh okay

#

omg I love you

#

I had no idea it would give me the exact location where it goes wrong

#

it just did โค๏ธ

#

(nohomo)

bitter oriole
#

See, I wasn't exagerating here

#

Important stuff includes the call stack panel, which is useful for context

#

And there are locals & auto panels you can get from debug - windows that give you some variables

#

You can use DebugGameEditor now when variables are marked as optimized out

#

But don't forget to go back to Development after you're done

royal rampart
#

okay.. it calls a function from a class that doesnt exist yet basically haha

random nymph
#

What all can go wrong when using globaltimedilation per client to slow down time every time the client dies?

chrome bay
#

Won't really work. Anything using replicated movement will still snap to wherever it's been moved to.

random nymph
#

Any other issues than snapping? ๐Ÿค”

chrome bay
#

well, character movement will stop working

#

There's probably no limit to how many things that can go wrong when you start running the server and clients in different timesteps tbh

#

Just have to try it and see

bitter oriole
#

Just think, conceptually, about how you would handle slowed client inputs on the non-slowed server.

#

What works well (with some effort) is localized slowdowns where all players are slowed within a zone

#

Or slowing down one character, for all players

#

Or the whole scene, for all players

summer jolt
#

Hey guys is there a way to do replication in actor component ? .. the actor component will be attached to the character

ancient moth
#

Hello ! Someone who already setup a dedicated server with Steam could help me ? My dedicated and client are connected to Steam successfully but I can't see the session and the server is tagged as "LAN" on Steam server list even if I unchecked "LAN" on the session.

royal rampart
#

hey guys ๐Ÿ™‚ small question, Is it possible to send your playername (before you join the server) to the the server when you join it?

#

is there like a class that stays alive before and after connecting to a dedicated server?

chrome bay
#

there is not no, but when you join, your player name usually comes with your join string/options

#

Also depending on the platform, the server can get the name from the unique online ID

fierce oriole
#

Quick Easy/Dumb question. in an MP game where you may possess a car and other things, what is possessed? The controller? If so, where would you define controls and UI elements that would be persistent regardless of which controller you possess?

chrome bay
#

Depends

#

Usually the vehicle itself is a pawn, and you would possess that

#

The controller is never "possessed", the pawn is

fierce oriole
#

and keep the same player controller?

#

oh ok

chrome bay
#

yeah

#

Which is why any pawn-specific input such as "walk forward" etc. should go in the pawn not the controller

fierce oriole
#

thank you. that makes things much clearer lol. And when you attach a pawn to a new pawn (like a driver to a pawn) it usually is the car that plays the "driver" driving animations correct? the walking player pawn is destroyed and recreated on enter and exit?

chrome bay
#

I keep the same pawn usually

#

And just apply a different animation blueprint to it depending on what "seat" it's in

fierce oriole
#

you attach to parent?

chrome bay
#

yeah, possess the vehicle, then attach the character to said vehicle

fierce oriole
#

is that the proper MP way? to attach to actor component?

chrome bay
#

You don't have to do it that way, in another game I work on where vehicles have multiple seats the player stays possessing the pawn, and the "attachment" is replicated through the seat itself

fierce oriole
#

OK so either way Id need "seat" components in the car to either attach or represent the player in that seat though right?

chrome bay
#

Well we use seat "actors", since the seat is usually something the player has to own in order to call RPC's etc (since they need to do things while in those seats, not just sit there)

fierce oriole
#

ok that makes sense. The whole RPC thing just finally clicked for me a while ago haha

foggy wave
#

for some reason client side cant find the other actor to destroy it
but it works fine from the server side
any helpM/
?

plucky sigil
#

Is it possible to have OnRep called for server ?
I want to do some sever side only stuff

winged badger
#

what do you need OnRep for then?

plucky sigil
#

Or should Client RPC called on OnRep ?

winged badger
#

server can do its stuff when setting the variable

#

doesn't need a replication callback

#

(with blueprints you'll get one weather you want it or not though - on Server as well)

#

c++ is more civilized, won't call OnReps for server

plucky sigil
#

server can do its stuff when setting the variable
@winged badger How do i make this stuff i want to do only happen on server side

winged badger
#

make a Set function for the variable

#

do what you need to inside of it, and set the variable

#

never set the variable directly, always use the function

plucky sigil
#

๐Ÿค”

#

I want to be able to have two versions of things happen when that variable is set

#

Inside the Set function i do the server side stuff

#

And OnRep i do the client side stuff ?

winged badger
#

then check IsServer, use Authority Switch inside of it, w/e

#

just don't call the Set function back from Blueprint OnRep

#

as the BP OnRep is a hack, not a replication callback

#

so if you try to set a variable you're OnRepping for from OnRep, you'll end up with infinite loop

plucky sigil
#

Do i use GIsServer ?

upbeat basin
#

Hey all, is there anyone who used OverrideWith event on PlayerState that can help me? I'm working on my reconnection case and having some issues, the variables I get from the returned PlayerState has default values instead the old ones

winged badger
#

did you check if the data is valid in InactivePlayerArray?

#

you could just breakpoint the GameMode::Tick in the debugger and read the data out from Locals (while the player is disconnected)

#

or breakpoint AGameMode::AddInactivePlayer

#

and FindInactivePlayer

upbeat basin
#

How do you mean by checking if it's valid? This is what I do in my playerState after changing the k/d/a variables a bit (and I see them on UI). I change map, travel to server again and the values that I try to get are all 0

winged badger
#

i mean build DebugGameEditor binaries, start the Editor from your IDE, and put breakpoints in code to see whats going on

plucky sigil
#

@winged badger I dont understand
I dont know where to put the server side logic

Player A kills Player B
Server calls PlayerB->Dead = true; andPlayerB->SetVisbility(false);

OnRep_Dead() SetVisibility(true); and RenderAsAGhost();

How can i do the OnRep_Dead() for when PlayerB is Server while also not replicating this to other clients ?

daring igloo
#

Hello. Is it possible to switch between characters using Posses and running it localy on the client with bCanPossessWithoutAuthority. What are the consequenses for this?

plucky sigil
#

@winged badger Can you help me ?

upbeat basin
#

Okay I see, I'll try it

winged badger
#

if you're not comfortable with c++ i would not advise it though

#

i didn't know this was exposed to blueprint to start with, so i just assumed you were using c++ ๐Ÿ™‚

upbeat basin
#

As far as I can see they both (c++ and bp) called from same function named DispatchOverrideWith

winged badger
#

yeah, but the interesting part is where the DispatchOverrideWith is called from

upbeat basin
#

From GameMode, on PostLogin fn

winged badger
#

AGameMode::FindInactivePlayer mainly

upbeat basin
#

Yeah, PostLogin calls find inactive player and if it's found it calls the overrideWith with old state

winged badger
#

in my experience, engine can have a few landmines, more so in GameMode then other places

#

so its worth checking the values as it finds the inactive playerstate

#

the Event in BP is BlueprintImplementableEvent, so Parent call definitely doesn't do anything though ๐Ÿ™‚

hazy spear
#

@arctic lionas For server only sided stuff you can just use the switch on autority node
It will let the signal go through on the top output if the object using the node is owned by the server (aka it has authority)

winged badger
#

i suspect this scenario is that owning player sees its pawn as ghost, while others don't see the pawn at all

#

for that you need IsLocallyControlled() check

#

if true, render as Ghost, if not set invisible

#

@plucky sigil

upbeat basin
#

Okay one thing that I realized is, it of course doesn't have the blueprint variables in it since it's stored as the base C++ class in the inactive player list

#

I can see my Score (From APlayerState) is having the old value but still printing 0 at the ss I sent, so I'm now trying to track that

winged badger
#

it does have the blueprint class type at least?

upbeat basin
#

I don't know if I get what you mean correctly but no I don't have any reference of my BP class in my C++ base class (I don't even know if it's possible?)

winged badger
#

i mean the debugger should still be aware of what type it is, regardless of what supertype its stored as

#

nvm, it will be of the right class, they are not doing anything crazy here

upbeat basin
#

Okay am I doing something wrong or using this event out of it's usage? This is AGameMode::FindInactivePlayer(). I am watching the Score variable coming from APlayerState which I set to 1 before changing level and coming back. But the PlayerState given to OverrideWith event is the new PlayerState (named as OldPlayerState) so having the 0, default value

winged badger
#

that is weird

#

so you have good values in your Active PS

#

before OverrideWith is called

upbeat basin
#

God damn it, it's the CopyProperties event that gives me the old value

winged badger
#

as they are swapped inside FindInactivePlayer

#

then they send the OldPlayerState (the one that was just spawned by the new joining PC)

#

as an argument to OverrideWith

upbeat basin
#

Still blueprint variables are not coming but the score (C++ variable) is finally printing the value I set before reconnection

winged badger
#

can you just Print those values on BeginPlay, ignoring both CopyProperties and OverrideWith?

upbeat basin
#

Okay

winged badger
#

i suspect epic did something very weird here

#

and very unnecessary

#

if that fails (as BeginPlay will probably not get called on the reactivated PlayerState)

#

inside OverrideWith, Print the value from this instead of the PS you get as a parameter

upbeat basin
#

Okay, on BeginPlay it also gives the default values

#

Engine is 4.21 BTW, if it changes anything

winged badger
#

i doubt they touched this code since 4.1

upbeat basin
#

I thought CopyProperties was to get variables when changing level while still being connected to the server. And OverrideWith to get old PlayerState in case of disconnection and reconnection afterwards. But apparently CopyProperties is the thing to use in case of reconnection, now I'm not sure what OverrideWith does

winged badger
#

i think its there to confuse you

upbeat basin
#

Hahaha

winged badger
#
            // found it!
            APlayerState* OldPlayerState = PC->PlayerState;
            PC->PlayerState = CurrentPlayerState;
            PC->PlayerState->SetOwner(PC);
            PC->PlayerState->SetReplicates(true);
            PC->PlayerState->SetLifeSpan(0.0f);
            OverridePlayerState(PC, OldPlayerState);
#

so player rejoins

#

the PC is instantiated, it instantiates PS in its PostInitializeComponents

#

before this is called

#

then they cache the newly instantiated PS into OldPlayerState local variable

#

assign the PS that was in InactivePlayers to the PC (so basically at this point PC has its own instance of the PlayerState)

#

and do basic initialization on it

#

so thats it, new playerstate you don't need was swapped for the good old one

#

then they call OverrideWith on the PlayerState pulled from inactive list and send the vanilla one at all defaults they just instantiated as a parameter

#

so if you were to just Print those variables from OverrideWith but on self instance, not the one provided as parameter

#

it should work

upbeat basin
#

Exactly

#

Just tried it and it works the way you said it. Apparently BeginPlay is called before this part so that's why it still prints 0. So these are just events to let us know that the old values are set

#

But I just don't get the difference

#

It's possible to get class defaults without having a newly created object. Why would I need to get my newly created PS before overriding?

#

Well thanks anyway for the debugging idea, I wouldn't be able to understand I need C++ variables for this without that and still be frastuated by not getting my old values on both OverrideWith and CopyProperties events

winged badger
#

the c++ OverrideWith does some useful stuff

#

as the new PS spawned with the controller does have some automatic initialization

#

as the old, reactivated PS has no reason to call BeginPlay at all

#

i don't see how it would make its way back to GameState's PlayerArray

peak sentinel
#

Steam is not working when I run the game standalone, it only works on launching the game. Can I fix this?

winged badger
#

no

royal rampart
#

heyyy, mini question, is there a variable i can store in a struct that is unique for each client, even if they disconnect en reconnect to the dedicated server?

fathom dust
#

where should I look to track down why my OnRep_Variable functions are not firing some of the time on clients?

bitter oriole
#

If the score increases too quickly, it's normal for only the last update to fire

void nest
#

Is it "safe" to increase the net update frequency of the playerstate which is by default extremely low (at 1 by default), I'd increase it to 10. Is that reasonable?

#

Question is why is it's net update frequency so extremely low in the first place? Which is why I'm a bit hesitant

#

Thing is that we've got a voice chat system which has a boolean variable which toggles true or false when a player uses voice chat, but due to the low update frequency it can sometimes take up to a few seconds before the boolean updates

fathom dust
#

@bitter oriole it's pretty slow (30+ seconds), it just sometimes doesn't fire at all ๐Ÿ™‚

#

but I'll keep digging

chrome bay
#

@void nest Call ForceNetUpdate when you change the bool instead

#

If you have a VOIP system though, then surely the client knows who is/isn't speaking from that and doesn't need a replicated var

void nest
#

ah yes of course doh why didn't I think of that

heady forum
#

I'm looking around for how to use the console in a dedicated server instance, and surprised I'm not finding any answers. It seems most of the questions online are about how to do that programmatically from a game instance. I just want a TTY. For example, using "Device Output Log", I can engage with the console of a game instance running on another device. Is there no equivalent for dedicated servers? My intent is to check and set cvars.

foggy wave
#

trying to replicate flashlight but still the other player cant see the light

normal jacinth
#

What class is that in Chaotic? If itโ€™s your player character I donโ€™t think it can send messages to other clients directly, you have to go through another class first

#

Or, because the character is replicated already, make sure the light is set to replicate

foggy wave
#

@normal jacinth first yeah its my character and second how to i set the light to replicate

normal jacinth
#

Select it on the viewport and choose โ€˜replicatesโ€™ in its Details panel

foggy wave
#

you mean that

normal jacinth
#

Yep

velvet brook
#

When im replicating particle spawn why does this not work? I'm doing Input(from the player controller) > Server RPC. It only works when I put the multicast and particle spawn on my actual player NOT the controller.

foggy wave
#

@sudden spire is it necessary to put flash light on another class?

mighty crown
#

hello, is there a multiplayer network course somewhere?

normal jacinth
#

I would have thought that tick box would be enough

velvet brook
#

@foggy wave go into class defaults

foggy wave
#

k and then?

velvet brook
#

check replicates

foggy wave
#

checked already

velvet brook
#

are you calling it from server

#

Server call > multicast

#

oh yea

#

ur missing server call

normal jacinth
#

Brocori I donโ€™t think player controller can multicast, you need to go through gamestate or something similar

velvet brook
#

ohh it works on player character

#

that makes sense

#

@foggy wave do it like this

#

however

#

make sure the last bit

normal jacinth
#

Character replicates, controller doesnโ€™t

velvet brook
#

isn't on controllers

#

ahh got it ty @normal jacinth

foggy wave
#

so brocori what should i do

#

my event is already multicast

velvet brook
#

Go from Player input > Run on Server > Multicast

#

Currently you are Player input > Multicast

#

look at my picture

#

the middle event

foggy wave
#

niceee!

#

thats perfect thanks

velvet brook
#

np

#

is your multicast on a controller?

#

it looked like it

#

actually i think you can put input on characters like that too right?

normal jacinth
#

Is GameState (server) - Get all actors of class (Player character) -> correct way of playing functions on everyoneโ€™s character?

uneven cliff
#

Anyone know how to simulate lag? Net PktLag doesn't seem to work

meager spade
#

it does work

uneven cliff
#

Maybe I'm using it wrong. Is it supposed to be called from the console?

peak sentinel
#

Maybe I'm using it wrong. Is it supposed to be called from the console?
@uneven cliff shouldnt you supposed to put it to DefaultEngine.ini ?

#

`[PacketSimulationSettings]
PktLag=500

[/Script/Engine.Player]
ConfiguredInternetSpeed=500000
ConfiguredLanSpeed=500000

[/Script/OnlineSubsystemUtils.IpNetDriver]
MaxClientRate=5000
MaxInternetClientRate=50000
NetServerMaxTickRate=120
MaxNetTickRate=120`

add this to .ini file

uneven cliff
#

Alright, I'll try that. Thanks

#

Oh that's nice and all over the place. Thank you @peak sentinel

crystal crag
#

Is there a way, when using the editor, to increase the time until the server disconnects you and crashes when debugging? I'm tired of having to race through the break points to avoid having to start all over again because the IPDriver_0 timed out

ocean trellis
#

I'm experiencing an extremely odd issue and would love to know if anyone else has experienced this, and if they were able to resolve it

I'm building a multiplayer game:

  • When a single listen server is present, it can look around but not move
  • When a listen server and client are present, but the client is a spectator, then the listen server still can't move. Even stranger, the client can see the listen server turn and even jump but the listen server doesn't even show this interaction
  • When both the listen server and the client are spawned, both work as expected
turbid falcon
#

Nick, somethings funky in the replication

#

Does the listen server see the client moving around and doing stuff when the client isn't a spectator?

peak sentinel
#

How can I get a variable in the gamemode in the widget blueprint?

#

nvm i cant

swift kelp
#

in my constructor I have

    HoleCardsCam = CreateDefaultSubobject<UHoleCardsCam>("HoleCardsCam");
    bReplicates = true;

and I have this function
that is blueprintcallable

#

and it works when I am the server but not the client, any ideas?

#

no movment at all if I am the client

#

client is APawn

#

forgot the

UFUNCTION(Server, Reliable, WithValidation)
    void Server_SendMove(FTransform);
soft relic
#

Would making a dedicated server with playfab work the same way for oculus quest as well?

swift kelp
#

so you can't really do networking with blueprint, ok

vivid seal
#

you could just make a c++ client/server function that calls a regular blueprint implementable event, depending on the context

soft girder
#

Has anyone done anything similar to for honor's melee combat?

lapis breach
#

@soft girder i worked on for honor for a little while and all of the combat is animation driven, this is able to function well as the entire game runs under simulation.

#

realistically 'for honor' combat is several simple systems working symbiotically, first of all i would split the combat up

#

ill be back in a bit and ill break it down further ๐Ÿ˜„

fierce oriole
#

Im have a Day/Night Cycle using my GameState to Increment DateTime and then casting from my Level BP to the GameState to update SunPosition. Im using FInterp to smooth out after timescales but its still jumpy.
Is there a better way besides casting every tick? Like an interface or putting the code in an world actor?

winged badger
#

like having the Sun Actor update itself as it has access to time and doesn't need external object to update it you mean?

#

also, as long as your server/client times are roughly in sync (see ServerWorldTimeSeconds) in GameState

#

client doesn't need to be updated over network anymore, as the time passes at the same rate on client and server (unless you have time dilation and/or pause controls)

#

so client can move its own sun on its own and then it won't jitter

fierce oriole
#

@winged badger yeah I have Ultra Dynamic Sky which uses a float(0-2400) that I lerp from the DateTime being elapsed. The reason Id like to control it from the GameState is so that the Admin Player can adjust DateTime/DayCycle on runtime. Im not currently using any RPCs as it replicates already right? I do note I have to replicate the variables in the GameState, but I dont need to call RPCs

#

It starts getting jittery when I multiply the time elapsing 60x and beyond. Im incrementing milliseconds every 10 milliseconds using an Event on the GameState

fierce oriole
#

OK I got it working by adjusting the interp time to .01

#

OK dumb question though: Lets say I want an intermediate Lobby level, where players can spawn in and screw around, and an admin player sets the parameters of the new matches GameState before loading the actual gameplay map. How would I transport all the players to the new level with the specified parameters? How would I carry over the variables for the new GameState in the new level?

upbeat basin
#

Hey all, my FSocket disconnects without any obvious reason from time to time. When I get error code with ISocketSubSystem.GetLastErrorCode() it gives me 26 (SE_ECONNRESET). Is there anybody knows what does it mean?

bitter oriole
#

Sockets tend to do that really

#

Try to reconnect when that happens

rain coral
#

I have a situation where the client doesn't always (only sometimes) receive certain replicated variables (at least no OnRep is run) of other clients' pawns when they join an ongoing game. No OnRep is run when the client joins the game, and it only runs the next time the variables change on the server. I have no idea why. Ideas?

winged badger
#

variables are references to replicated Actors and you're using Blueprint, would be my guess

rain coral
#

They are structs in C++, contain one reference to a replicated actor and an enum value

winged badger
#

the actor reference can't be resolved unless the Actor itself has already replicated

rain coral
#

It has definitely replicated, it's visible on the client

winged badger
#

you can't really eyeball that

#

which comes first, the variable replication or the replicated Actor

#

normally, c++ should call OnRep when the Actor's NetGUID is resolved

#

but i am unsure if having a nested reference would prevent that from happening

#

its not a structure i would ever use

rain coral
#

Hmm, I see. And the enum value seems to be default at the one that they're supposed to receive. So yeah you're right, that makes two default values in the struct, thus no change

#

It's a variable describing an "event" like (spawned with this item, picked up this item, threw this item etc), so it's the item in question + the enum to describe what to do on client in response to this item reference changing

winged badger
#

use a fastarray

rain coral
#

I'm gonna have to change it a bit so that the item reference is always replicated at the time this is updated.

#

Hmm what's fastarray?

winged badger
#

as item is a replicated actor im guessing

#

it can replicate its own state

#

so not quite sure why the enum on the side

#

FFastArraySerializer

#

its much more capable

#

does Add/Remove/Change callback for each of its items individually

#

and if a replicated UObject* can't be resoplved when PostReplicatedAdd is called, it will call PostReplicatedChange after it is resolved

rain coral
#

Ah hm that sounds interesting. Does that mean if I have a fastarray with one such event inside, and the actor in question isn't replicated when the actor reference is replicated, then it's going to replicate the reference after the actor is replicated, on its own?

winged badger
#

it won't replicate it, but it will trigger a callback

#

replicated Actor != replicated reference to an Actor

#

anyhow, the docs for it are in NetSerialization.h header

rain coral
#

Thanks, will check that out, and come back if I don't understand ๐Ÿ‘

soft girder
#

@lapis breach thanks for responding. we are thinking of something similar

#

not really tho

#

hard to explain

queen quiver
#

Anyone know why this configuration of blueprints seems to consistently cause crashes? It only happens when I have a custom event run on the server into a custom event that multicasts (but regardless of what configuration I have I can't get the message to replicate):

foggy wave
#

how do i replicate those sounds so only the client can hear those , or maybe those who are around

#

because now where ever the player is can hear the other ones step sounds

arctic willow
#

SetVisibility turn on (previously turned off) doesn't turn on the visibility of my Character for the other clients immediately, only after he is moving. This is my setup:

#

It should only hide the character for all the clients except the client who hid himself.

#

I tested it with only the owning client and it works there, without moving. But it seems that for SimulatedProxies the SetVisibility set to on doesn't work immediately :/

vale ermine
#

we discussed this a few days ago

#

@arctic willow 10/13 is when we talked about IsNetRelevantFor and ForceNetUpdate but there are draw backs

arctic willow
#

okay, will have a look at that. Thx

vale ermine
#

The other suggestion given was replication graph.

agile escarp
#

Hi, is there a way to switch between GameNetDrivers on the fly during runtime? we would like to set up our game to support dedicated servers and Steam p2p play at the same time

quasi kite
#

Trying to run the project as network now, and I noticed my custom HUD event gets called when running as listen sever, but not as client.
Is the difference in these two modes the authority level at which your logic runs at?

lapis breach
#

@soft girder really you want to split it into two sections attacks and defence

#

defend is up left and right

#

attack is the same

#

the most fundamental part of that system is how the animations work

#

inside each animation there is a window which allows that particular attack animation to be parried or blocked

#

the defender needs to hit their response within that time frame

#

its funny i was thinking about how i would do it in ue4 the other day

#

i would create a notify state which set vars to allow a guard break within the period that you want to be able to parry and block

#

let me know how it goes or if you have any issues ๐Ÿ˜„ ill be interested to see how it turns out

dark edge
#

@foggy wave don't replicate sounds directly, replicate the events or state that drive the sounds. For example, you don't do anything replication wise that involves the sound of a gunshot, but what you replicate is the fact that the gunshot happened, and locally on each machine the sound is played.

lilac raven
#

Hi all, got a question, I have steam works implemented into my project, but when running the game on two separate pcs to connect via steam matchmaking, they wont connect, here is my bp, steam overlay works in build, so i am very confused as to why it wont connect.

normal jacinth
#

@lilac raven I don't understand your For Loop on join session; you're accessing an array after the loop has completed, which I don't believe works

lilac raven
#

@normal jacinth could that explain why when connecting through steam, it finds the session but fails to join?

#

What is weird is in PIE it works fine, connects to the server no problem!

normal jacinth
#

what build did you create, development or shipping?

lilac raven
#

development

normal jacinth
#

did you configure the steam app ID in configs?

lilac raven
#

yeah, I set everything up the way it is in the Documentation, if the appID didnt work surely the steam overlay would fail and it wouldnt show me playing spacewars right?

normal jacinth
#

yeah that sounds right

lilac raven
#

hmm, it's strange, i can test a shipping build see if that works, I changed the for loop for a get copy of value 0

normal jacinth
#

actually the shipping build doesn't work unless you have a registered steam id (something other than 480)

#

sorry I can't be of more help

lilac raven
#

ah ok, thats ok, thanks anyway! ๐Ÿ™‚

queen spade
#

Hey all,
I'm making an infinite procedural game where the terrain is made using instances of a hexagon mesh. I'm wondering how I would go about setting this up for multiplayer. I currently have it set up so the seed of the noise generator is sent from the server to all the clients so everyone has terrain that looks the same. However, I'm running into some problems that seem to be related to Unreal not treating these instances the same across the network and it's causing various problems with player movement and collisions. Does anyone have a solution for this?

LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: HierarchicalInstancedStaticMeshComponent /Game/Maps/UEDPIE_1_MainWorld.MainWorld:PersistentLevel.HexMapGenerator_1.HierarchicalInstancedStaticMeshComponent_17 NOT Supported.

This is with component replication disabled for the instanced static mesh components that are generated at runtime and actor replication enabled for my terrain generation actor.

meager spade
#

why are you replicating them

#

@queen spade

#

you cant replicate a Instanced Static mesh

#

and for that to come up you would have turned on replicates on that instanced mesh

tranquil yoke
#

Guys, how would i make player make stay longer inside , if loses connection and rejoin the same game without going to the lobby, and sometimes what happens is if someone is disconnected then, there Pawn remains inside

peak sentinel
#

if i put an instanced static mesh to my level, it wont be visible for clients??

queen spade
#

@meager spade I'll have to look into it, I shouldn't be replicating the actual components, but the actor that creates them is being replicated. I'm just calling staticMeshComponent->SetIsReplicated(false); for each static mesh component I create. If I disable replication for the c++ actor that creates the components it doesn't show anything on the clients.

meager spade
#

i don't even replicate an actor for procedural generation

#

i send the seed and just have the client simulate

#

all done via the gamemode

queen spade
#

interesting, seems I'll have to rework some of this. Thanks for the help.

full ember
#

Hey guys! From your experience, how would you implements a Multiplayer Voice Chat, for about 10-15 people in any single game?
Also, must record each of the players session/channel separately. No sound FX or design needed, just simple chat and synchronized recording.
Preferably using BP
thank you!

rich ridge
#

@full ember Fortnite and Pubg usese Vivox. Please look at it.

full ember
#

๐Ÿ™

rich ridge
#

Epic EOS is due for Voice Chat support, you can also have a loot at that too.

full ember
#

Even though i just need a POC at this moment, I don't want to do all the heavy lifting by myself so I'll look into it.

twin juniper
#

hey

#

can anyone help me

#

I need it to work for client also

full ember
#

@rich ridge seems like Voice Chat in EOS will be "coming later". so VIVOX i guess

ornate sparrow
#

Has anyone ever worked with long polling in UE4? I'm normally using Blueprints, but I have a community section in my app and I need to implement long polling to allow users posts / comments to be regularly pulled from my node API endpoint.

#

Is this possible?

#

Right now I'm using VaRest for doing individual JSON queries to my API endpoint.

ornate sparrow
#

Alternatively, I might have to use web sockets, which I am willing to do if required,since there are clearly plugins built to support it.

soft girder
#

@twin juniper why do you have the switch has authority?

#

Possession should prob be done in gamemode. btw gamemode and gamestate need to match. either both bases or both non bases.

#

there might be a way to do via rpc calls from the level blueprint

#

idk ive never tried it from anything else

soft shell
#

QQ; How would you ideally implement a "Press E to open" kind of door.. I mean, how does a non-owning client (of the door) transfer the "Open this door" to the server? Is the functionality for doors placed inside the player controller or pawn, which can execute server stuff (as owning client)?

soft girder
twin juniper
#

@soft girder can u explain more

#

Actually my friend told me to use switch has instance

soft girder
#

well ive seen alot of people handle possesion in the gamemode

#

thats really all

twin juniper
#

Will that work for me

#

And for all clients

soft girder
#

make sure that your gamemode blueprint and gameinstance blueprint both inherit from bases or non base. non base gives control over is match started and start match

#

what happens if you dont use the switch has authority?

#

oh never mind

#

player pawn 0

#

player pawn zero is always the local player of a machine

#

except if the server is dedicated ofc

#

you could prob just make an array of all playerpawns and loop through it

#

ive never used switch has instance so idk. he might have a good solution too

#

but the reason it only works for server is because its only getting player pawn 0 which is the servers local controller

#

you will need an array of all player controllers. loop through the array and give possesion to each controller

#

hang on i see what your doing.

#

let me get a test project and ill wire up a picture to give you

#

@twin juniper

#

what does this do

#

give the overlapping player a vehicle

#

you dont need an array

twin juniper
#

Ok

#

Still confused need to implement and understand

#

@soft girder

soft girder
#

tell me the gameplay. im confused. is there already a character actor? and when it overlaps you wanna give that character the vehicle character?

#

what you have done will work but the target of the cast is always going to be pawn at index 0. you need the actual one that overlapped i believe.

#

im unsure what your doing. i need more info but so far im under the impression that the vehicle actor ovelaps something and you wanna destroy it and give the player a new one

#

if the vehicle is overlapping that newblueprint 1 thats the one you need to cast from

twin juniper
#

Yes

#

@soft girder

soft girder
#

switch has authority is correct because only the server can give possesion. but who is being destroyed and possesing is the problem here

twin juniper
#

The aim is that vehicle when hit the trigger it get spawn to a position and also give its control but it is only happening for server

#

The bp I have implemented is working only on server

#

And I wish to use for client also

soft girder
#

because the cast is always pointing to player pawn 0

#

you need the one that overlapped. thats what the blue dot on the overlap node is

twin juniper
#

This is my bp

#

I have implemented

#

Which work perfectly on server

soft girder
#

same problem

#

player controller 0

twin juniper
#

Yes

#

Possess run only on server

#

And it is accessing only server controller

#

If I change the index then it is making problem

soft girder
#

no

#

hang on

twin juniper
#

Yes

soft girder
#

did you try this?

#

you also might need to change the cast to the overlapped actor instead of other actor

twin juniper
#

Yes

#

I tried

soft girder
#

im doing it with a character instead of a vehicle and it works

twin juniper
#

This one too

#

Not working

soft girder
#

what blueprint is that code in? the level blueprint?

twin juniper
#

Yes

soft girder
#

hang on im gonna try and move mine over to the level blueprint and see if it changes

twin juniper
#

Okay

thin stratus
#

There are a few weird things in that Image

soft girder
#

could he not put that code in the actual actor that has the overlap volume

thin stratus
#
  1. Calling Destroy Actor but then afterwards accessing it is not a good idea. Actor would be marked as PendingKill which could fail specific checks. Always destroy when you don't need the Actor anymore.
  2. The ID on the "GetPlayerController" is for Local Couch Coop. Not sure if it gives you anything in regards to actual Multiaplyer.
  3. The ID that you grab from the PlayerState, if that's your own, then it's fine. If that's the one from the native class, then that has nothing todo with the ID that the GetPlayerController wants.
  4. Why don't you just save the referecen to the Controller into the Actor instead of grabbing it via some weird PlayerState ID?
  5. Why don't you just get the Owner of the PlayerState, which is the PlayerController?
#

And yes, LevelBlueprint should be avoided anyway.

#

If you need that logic in a different Level you are already forced to copy paste the logic and update/maintain it in more than 2 places.

soft girder
#

ive always handled spawn and posses in gamemode and thought that may be his problem.

#

i didnt have the player state or id either

thin stratus
#

Idk what his problem is (in terms of what is not working) but the code in that image is basically worth throwing away.

soft girder
#

didnt think about that being an issue

thin stratus
#

"GetPlayerController" is very likely not what they want to do there anyway

#

Just get the Owner of the PlayerState if you want the Controller that belongs to it

soft girder
#

thats nice to know

thin stratus
#

And if that overlapping actor is an actual vehicle that can be possessed, then I'm sure it already has a reference to the Controller.

#

So the PlayerState->ID->GetPlayerController is totally redundant and probably wrong.

#

Unless it's randomly placed into the world. I don't know the context

#

But yeah, not surprising the code is not working

twin juniper
#

@thin stratus @soft girder what should I do

soft girder
#

i just got the controller straight from the third person charcter

twin juniper
#

What's your solution

thin stratus
#

Sorry I don't know what you are trying to achieve. Didn't read anything despite the Image.

#

Just threw some thoughts into the round

soft girder
#

this code is inside a box actor i made that overlaps all

#

it works for server and client

thin stratus
#

That looks correct to me.

#

(could be cleaned up a bit to make it more readable!)

soft girder
#

lol

#

you should see my other monstrosities

#

jk

#

ya

thin stratus
#

Like for your own code, i don't care. but if you show someone somethig, try to make it readable

soft girder
#

thats just ugly and quick

thin stratus
#

Put a Sequence in there for example, so it's clear that destroy actor happens after everything else.

acoustic marten
#

Anyone here used unreal simply for the rendering and ran the logic outside that then connected to a server?

soft girder
#

oh ya

#

a seq is better

thin stratus
#

Anyone here used unreal simply for the rendering and ran the logic outside that then connected to a server?
You mean replacing UE4's network and server architecture with something else?