#multiplayer

1 messages ยท Page 576 of 1

vivid seal
#

okay can anyone tell me if this is going to work how i think it will?
i have an ActorComponent called UBuffContainer:

void UBuffContainer::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    DOREPLIFETIME(UBuffContainer, Buffs);
    DOREPLIFETIME(UBuffContainer, Debuffs);
    DOREPLIFETIME(UBuffContainer, HiddenBuffs);
}

bool UBuffContainer::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
    bool bWroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

    bWroteSomething |= Channel->ReplicateSubobjectList(Buffs, *Bunch, *RepFlags);
    bWroteSomething |= Channel->ReplicateSubobjectList(Debuffs, *Bunch, *RepFlags);
    bWroteSomething |= Channel->ReplicateSubobjectList(HiddenBuffs, *Bunch, *RepFlags);

    return bWroteSomething;
}

Now, each of those subobject lists (Buffs, Debuffs, HiddenBuffs) is a TArray of UBuff*, and i want to be replicating those buffs.
Here is some of UBuff:

virtual bool IsSupportedForNetworking() const override { return true; }

void UBuff::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME(UBuff, CreationEvent);
    DOREPLIFETIME(UBuff, LastApplyEvent);
}
#

CreationEvent and LastApplyEvent are structs, that also contain a TArray of UBuffParameter*, which i will also need to replicate.
UBuffParameter:

virtual bool IsSupportedForNetworking() const override { return true; }

void UBuffParameter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
    Super::GetLifetimeReplicatedProps(OutLifetimeProps);

    DOREPLIFETIME(UBuffParameter, ParameterType);
}

Okay. So back in UBuff, i am trying to do this:

bool UBuff::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
    bool bWroteSomething = Channel->ReplicateSubobjectList(CreationEvent.EventParams, *Bunch, *RepFlags);
    bWroteSomething |= Channel->ReplicateSubobjectList(LastApplyEvent.EventParams, *Bunch, *RepFlags);

    return bWroteSomething;  
}

I do not call Super::ReplicateSubobjects first because no method exists (UBuff is a UObject and doesn't have that function).

Can someone tell me which steps, if any, i am missing, and how to get this working?

meager spade
#
{
    bool bWroteSomething = Channel->ReplicateSubobjectList(CreationEvent.EventParams, *Bunch, *RepFlags);
    bWroteSomething |= Channel->ReplicateSubobjectList(LastApplyEvent.EventParams, *Bunch, *RepFlags);

    return bWroteSomething;
}``` < this should be an actor
#

not in the buff.

#

or an actor component

#

only actors can replicate

vivid seal
#

so would i do something like

for (UBuff* Buff : Buffs)
{
  bWroteSomething |= ReplicateSubobjectList(Buff.CreationEvent.EventParams, *Bunch, *RepFlags);
  bWroteSomething |= ReplicateSubobjectList(Buff.LastApplyEvent.EventParams, *Bunch, *RepFlags);
}

and do the same thing for debuffs, hiddenbuffs, inside the actor component that contains them all?

meager spade
#

actor components replicate via ReplicateSubObjects in an actor

#

so if your ActorComponent is replicated, on a replicated actor

#

then yes you want to loop through the buffs on the component in ReplicateSubobjects

#

and add them to to subobjects

#

im assuming Buff.CreationEvent.EventParams this is a UObject right?

#

EventParams

#

is EventParams a UObject?

#

@vivid seal looking again

#

cause your code was kinda confusing

vivid seal
#

eventparams is a TArray of UObject*

meager spade
#

ok

vivid seal
#

TArray of UBuffParam which is a UObject

#

basically its like an array of objects within an array of objects within an actor component...

#

lol

meager spade
#

yeah i looked at it wrong

vivid seal
#
bool UBuffContainer::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
    bool bWroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

    bWroteSomething |= Channel->ReplicateSubobjectList(Buffs, *Bunch, *RepFlags);
    for (UBuff* Buff : Buffs)
    {
        bWroteSomething |= Channel->ReplicateSubobjectList(Buff->GetCreationEvent().EventParams, *Bunch, *RepFlags);
        bWroteSomething |= Channel->ReplicateSubobjectList(Buff->GetLastApplyEvent().EventParams, *Bunch, *RepFlags);
    }
    bWroteSomething |= Channel->ReplicateSubobjectList(Debuffs, *Bunch, *RepFlags);
    bWroteSomething |= Channel->ReplicateSubobjectList(HiddenBuffs, *Bunch, *RepFlags);

    return bWroteSomething;
}
#

could i do it like this?

#

replicate the buffs, then for each buff also replicate the parameters the buff contains?

#

might be some weird syntax there

winged badger
#

if you replicate buffs

#

they replicate

#

which means they can handle their own shit afterwards

vivid seal
#

the params are passed to them on the server every time they are refreshed or stacked

#

and the params are uobjects, so wouldnt they also need to replicate somewhere?

winged badger
#
bool UAttributeComponent::ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
{
    bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

    for (USolsticeBuffBase* Buff : ReplicatedBuffs)
    {
        if (IsValid(Buff) && Buff->IsReplicated())
        {
            WroteSomething |= Channel->ReplicateSubobject(Buff, *Bunch, *RepFlags);
        }
    }
    return WroteSomething;
}
#

not quite sure what you're doing with the rest of it

#

its for replicating subobjects not their individual parameters

vivid seal
#

the parameters are objects, UBuffParameter, because i needed them to be polymorphic for a few use cases

#

so the buff is replicated, but also has an array of pointers to Parameter Objects, that i'm assuming wont exist on clients

winged badger
#

did you read what i wrote about using a FFastArraySerializer?

vivid seal
#

i looked at it and didn't really understand what i was reading, i'll look at it again tho

winged badger
#

read NetSerialization.h header

#

(most of it is comments)

vivid seal
#

okay, thanks for the tip

winged badger
#

the approach you're currently using is unlikely not to keep breaking

#

network design needs to be straightforward to avoid replication races

#

and you're replicating multiple UObjects per Buff by the looks of it, a big nono

#

assembling that on the other side so that it doesn't break with latency and packet loss... ouch

vivid seal
#

but im pretty lost

winged badger
#

i have AttributeComponent

#

that manages buffs

#

each buff is a UObject

#

each buff has FBuffManager struct, which is a FFastArraySerializerItem

#

each buff manager holds a weak pointer to the Buff it manages

#

it replicates some stuff, like number of stacks

#

AttributeComponent also has vanilla non-replicated TArrays to hold the Buffs in

#

as weak pointer from the manager can't keep them alive

#

and it makes iterating over buff syntax simpler

#

when the Buff replicates, it triggers a callback inside the fastarray

#

which then puts the buff into appropriate container, updates my attribtues, lets the buff know its applied... etc

#

my attributes are not replicated in any way, only the buffs affecting them are

#

that system is 2 years old and i haven't had any problems with it for the past 18 months or so, after a few rounds of upgrades

#

it just works

vivid seal
#

and then you just apply changes to attributes on the client side after buff replication?

winged badger
#

yes

vivid seal
#

okay

#

i'm checking out that header file you said to read but i'm gonna need some time to figure out wtf its doing.

winged badger
#

buffs replicate their duration internally

#

well, duration resets by just replicating a uint8

#

that causes buffs to set remaining duration to total duration onrep

#

and total duration is also replicated, but remaining duration is not

#

i also have a non replicated category of buffs which are entirely predictable

#

so i don't bother replicating them, but just put them in a SimulatedBuffs array

#

like for example, monsters applying the GameDifficulty buff

#

on BeginPlay, GameState already replicated the Difficulty

vivid seal
#

as far as duration/stacks, i was originally just replicating the most recent application event as a property in the buff, which contained apply time and new duration/new stacks, and the client could figure out remaining time from there

winged badger
#

so each monster on each machine is perfectly aware of how to apply that buff, and it has the same lifetime as a monster, so there is no need to replicate it whatsoever

#

i just replicate total duration (it can be set at runtime often) and a uint8 which is basically "if this changes reset your duration" to clients

vivid seal
#

the problem im trying to solve with all the garbage code i pasted was for examples where i want to pass some arbitrary values to the buff on spawn/refresh/stack. the examples i had in my head were for a fear debuff, i would want to pass it the location of the thing it is feared by, or for a lockout buff, i'd pass it the school of spell it is locking out. stuff that is dependent on the game state when the buff is applied. i couldn't figure out a good way to pass different data types under one "parameter" property to the buff, so i created UBuffParameter, which i can subclass to represent different types of parameter. but i'd also want those parameters to be available client-side for UI display or visuals, which is how i ended up trying to replicate a subobject list inside a subobject.

winged badger
#

easy

vivid seal
#

easy is what i like to hear

winged badger
#
APawn* (or AActor*) Instigator;
//and
FGameplayTagContainer BuffTags
#

or an array of FGameplayTag, float values, that can be anything

#

i had to replicate a blueprint variable in a buff only once, on 130 buffs so far

#

and that was to orient the icing effect of a nitrogen grenade on clients properly

uneven cliff
#

@thin stratus I figured out the jittery thing. I'm not sure if this is only going to be a "works for my case" thing or not. I disabled animations to see if that was it, and it wasn't, but I noticed when I had movement input which wasn't directly forward, my character twitched a little when it changed. I looked at the rotation settings, and I changed Network Simulated Smooth Location Time to 0.5 (from 0.05) and it's Listen Server variant to 0.33 (from 0.033), both exist in the Character Movement Component. What happened was my client acted the same as it always had, but from the server's view, the client would rotate either left or right when moving in those directions (which it shouldn't do). I unticked OrientRotationToMovement in the Character Movement Component, and no there's no jitter whatsoever. Prior to this I changed a few settings in my custom Character and CharacterMovementComponent, so I'm going to revert those changes and see if the jitter returns. If it doesn't, them I'm assuming it was just the Orient Rotation to Movement.

vivid seal
#

the system i had for creating/refreshing/stacking buffs involves just passing a struct to the BuffContainer (after all the logic deciding whether to allow the buff, what action to take etc.), and i was looking for a way to have the struct contain a field just called "BuffParameters," which could be an array of... something that could be any different data type and some way to interpret it. so like you said, it could be gameplay tags, or floats, or anything, but i don't know how to create something like an array that contains multiple different types of data

#

without making an object to contain the data

winged badger
#

if you have a struct that has a gameplay tag and a float

#

that can carry almost any information

#

buff itself doesn't need to be aware of what that information is

#

just the object that end up reacting to it need to know how

#

examples:

#
Inventory.Gold 500.f (you have 500 gold)
Stats.Kills.EnemyA 30.f (you killed 30 EnemyAs)
Reward.XP 1400.f  (this reward is 1400 XP)
Incapacitated.Frozen 12.f (you get frozen effect for 12 seconds)
#

you can encode almost anything in a FGameplayTag, float pair

vivid seal
#

what would you do to represent a vector or a transform as a float? designate a certain amount of places for each value?

winged badger
#

for your fear, i'd just use the instigators actorlocation

#

or a replicated poitner to actor you fear

#

it has to be visible in some way

#

all my replicated buffs have their own class

#

plenty of stuff to do with them

#

so it makes life easier

vivid seal
#

i do pass a "Source" pointer to each buff which i was going to use to represent the weapon or ability that caused the buff, but i guess i could also use it for a projectile that is causing a fear

winged badger
#

almost all of them have custom logic

#

so they cann all replciate extra variables they need

#

its not just the gameplay effect you need to think about

vivid seal
#

yeah i had each buff creating little BuffFunction objects that contain what the Buff actually "does", and their classes are in a Server and Client function array and are spawned individually so i dont need replication

winged badger
#

you have to display them in a buff panel

#

have a sound when its applied or active

#

do a little particle system for each one

#

tons of other stuff

vivid seal
#

yeah, in my head the Server Functions would be stuff like gameplay effects (damage, cc, etc.), and the Client Functions would be visuals, sounds, etc.

#

i could just put it all in the buff object, but then it would be harder to reuse than jsut a "DoT Function" class i can slap on a bunch of different buffs

winged badger
#

i do have 2 FDataTableRowHandles on each buff on CDO

#

pointing to datatables

#

one with gameplay data

#

other with descriptions, display names, icons and, basicallyt UI and stuff that needs to be localized

#

as they progressed they got the ability to hook into active weapon and alter its damage output

#

and stuff like that

#

like 1-4 stacks give a minor bonus, then a 5th provides a large bonus to your next shot deal

#

and then buff removes its stacks and starts over

vivid seal
#

im always surprised that there aren't more easy to find answers for problems like multiplayer buffs. i guess everyone is just using GAS for this kind of thing?

#

but this discord is the only place i can find good information about specific systems like this

winged badger
#

i have 70% functionality for 10% complexity

#

of GAS

vivid seal
#

yeah that was the goal when i decided not to use it. but being better at c++ would probably make it a lot more attainable

twin juniper
#

Anyone ever use steamsockets ?

#

Any idea as to why a project is unable to load steamsockets ?

uneven cliff
#

@twin juniper What do you mean "unable to load" Did you make the proper DefaultEngine.ini changes?

twin juniper
#

Yep.

uneven cliff
#

Alright then. I'm not sure, I'm pretty new to steam sockets

#

@thin stratus Reverted the changes I made, and yeah, it was just the Orient Rotation to Movement. Setting that to false makes the jitter disappear.

quasi shoal
#

Im confused, why isnt my second client joining the right session? I have a loop to find session and if it doesnt find one it makes one. OK that works, but when I find a session with the second client it finds a session and joins it. But i dont see either of them in the session level

quasi shoal
#

So i got it to work, but i dont know why this works do. I had to call Open level first then create/find session weird.

gleaming niche
#

@twin juniper you've clearly made a typo, or something, because it's not "SocketsSteamSockets" it's just "SteamSockets"

twin juniper
#

haha.

#

I copy and pasted from the documentation.

#

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="/Script/SteamSockets.SteamNetSocketsNetDriver")

gleaming niche
#

and you enabled the plugin?

twin juniper
#

Hmm wait a minute.

#

this might be it.

gleaming niche
#

cuz it's saying it cannot find the module SocketsSteamSockets

twin juniper
#

holy hell lmao

#

ah nah.

#

that wasnt it.

#

2020.10.07-07.08.32:803][ 0]LogAISub: UAISubsystem::UAISubsystem AIPerceptionSystem (00000228FF01AAC0), frame # 0
[2020.10.07-07.08.33:716][ 0]LogLoad: Game class is 'MainMenuGameMode_C'
[2020.10.07-07.08.33:717][ 0]LogModuleManager: Warning: ModuleManager: Unable to load module 'SocketsSteamSockets' - 0 instances of that module name found.
[2020.10.07-07.08.33:717][ 0]LogSockets: Warning: Unable to load SocketSubsystem module SteamSockets

oblique brook
#

hey guys, so im stumped on this one, our game was able to connect to steam sessions host/join games no issues a few days ago, something along the way it broke, an connecting via steam no longer wants to find sessions, we reverted back to files we KNOW worked that connected via steam, an its still not working! wth???

twin juniper
#

i am on the same issue too lol

#

what error do you get specifically?

#

is it the timed out connection?

oblique brook
#

uhh i dont really get an error

#

when did your error occur?

#

3 days ago our multiplayer was flawless

#

now we cant find any sessions related to steam, "if steam is logged in"

#

the only kind of error thats even possible that we can think of , is hostip is invalid

#

but everything initializes an client listens on 7777

#

an again, reverting back to old builds we KNOW worked, isnt working ....

gleaming niche
#

you have the steam ports open too?

#

ie: the queryport, which default is 27015

#

though it shouldn't matter for presence sessions (steam p2p)

oblique brook
#

ya, was working fine 3 days ago lol

#

an 27015 is listed as a port in defaultengine.ini

gleaming niche
#

i meant in router

#

are you only doing listen servers?

oblique brook
#

the REAL confusing thing is reverting git to old files we know worked an still doesnt work..

gleaming niche
#

yeah so it sounds like an external issue.

oblique brook
#

i mean i had 5 players connecting an hosting

#

an i have hosted, they have, an nothing

#

i grabbed a build we had on steam

#

that i know worked, an retried it, an it works....

#

but does us no good cuz we cant grab a build for UE lol

#

so that ruled out backend steam itself with changes....

#

this is the only thing i can find....

#

as hostip shouldnt be invalid...

twin juniper
#

Are you using the steam sockets?

#

Or ipnetdriver

rose egret
#

I know that if a dynamically spawned actor becomes relevant in a client engine will spawn it.
now my question is what if that actor refrences lots of assets (mesh, texture, ...) that have not been loaded yet.
would the assets be loaded syncly or asyncly or what ?

#

๐Ÿค”

bitter oriole
#

Synchronously, of course

#

Unless you asynchronously pre-loaded assets before the actor was replicated

unkempt tiger
#

Anyone know how I can see server prints (or logs) when running a server on another process through the editor?

hybrid zodiac
#

Hi everyone, for my server browser, I want a dialogue box to pop up when the player clicks "join server" to say something like "Connecting to server..." so that they know something is happening and don't click the button multiple times, and then if the connection fails then a box to say that you couldn't join

thin stratus
#

And you have problems with that or have you not even tried to make that yet?

hybrid zodiac
#

Sorry haven't finished typing yet ๐Ÿ˜›

#

We are using the OnlineSubsystem plugin, just wanted to get an idea on the timing of popping up the message and removing it. I think I've narrowed it down to a call to JoinSession, which returns a bool if it was successful or not

thin stratus
#

Yeah, Joining a Session is a Latent action

hybrid zodiac
#

Ah ok, so it will return after a couple of seconds?

thin stratus
#

You would show the Dialog directly when you call JoinSession

#

And when it returns you hide the dialogue and travel to the new map.
Or you should the fail dialogue

#

Be aware that JoinSession itself also returns a boolean for the attempt to perform the async action

#

So that is a second point where you would need to display the fail dialogue of that retunrs false

#

You can ignore it if it returns true, because then it will hopefully return via the delegate

hybrid zodiac
#

Ah ok, so something like this:


bool bSuccess = Sessions->JoinSession(UserId, SessionName, SearchResult);

if (bSuccess) {
   HideDialogueBox();
} else {
   ShowDialogueBox("Something went wrong...");
}```
thin stratus
#

Join Session is async

hybrid zodiac
#

Ah just saw your previous messages, sorry

#

So I need to bind a delegate to it?

thin stratus
#
void JoinSession(Session)
{
  if (JoinSession(..., OnJoinSessionComplete))
  {
    ShowDialogue("Joining Server...");
  }
  else
  {
    ShowDialogue("Failed to join Server...");
  }
}

void OnJoinSessionComplete(bool Successful)
{

  HideDialogue("Joining Server...");

  if (Succesful)
  {
    TravelToSession(...);
  }
  else
  {
    ShowDialogue("Failed to join Server...");
  }
}
#

Something like that

hybrid zodiac
#

Aaah I see now, it looks like the guy who did our sessions system did this:

        {
            // Set the Handle again
            OnJoinSessionCompleteDelegateHandle = Sessions->AddOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegate);

            // Call the "JoinSession" Function with the passed "SearchResult". The "SessionSearch->SearchResults" can be used to get such a
            // "FOnlineSessionSearchResult" and pass it. Pretty straight forward!
            bSuccessful = Sessions->JoinSession(*UserId, SessionName, SearchResult);
        }```
#

So it looks like I just need to make some changes in OnJoinSessionComplete

#

Thanks for your help ๐Ÿ™‚

unkempt tiger
#

If I run a dedicated server, will normal UE_LOG calls print into the console?

#

There's some server debugging I need to do, and I gotta look at the logs

hybrid zodiac
#

@unkempt tiger Assuming the server is in debug or development configuration, then yes. Assuming that UE_LOG is in a function that is run on the server of course ๐Ÿ™‚

unkempt tiger
#

@unkempt tiger Assuming the server is in debug or development configuration, then yes. Assuming that UE_LOG is in a function that is run on the server of course ๐Ÿ™‚
@hybrid zodiac Thanks!

soft relic
#

question, if we know that a server function will always be called from another server function, do we really need to set that second function to a server one?

winged badger
#

you don't

soft relic
#

Okay thanks

soft relic
#

is it good to call a montage on the owning client and then call server to multicast to all others except the owning client?

shut gyro
#

Is there a way to compress a mouse delta input in a struct, which is unbounded by nature?

#

One of my thoughts was to get the sign of that float, store it in a bit and append that to the archive struct and convert the input into a [b - a /n, b + a/n] range to map it to a [-1, 1] range that can be compressed into a short and decompressed out from a float

#

And then, upon decompression multiply by that n value which maybe can be 100 since itโ€™s fair to assume mouse input canโ€™t go past that

#

Is there a better way?

stark fractal
#

Hello,
this is a weird one. I'm trying to replicate teleport, and for some reason when i replicate it from server and multicast it doesnt work at all. And if i do it only from owning client it runs only for the player that initiated it (client works too but doesnt show on other connected players host included)

I checked if it replicates as actor, also it replicates as movement and i set all variables to replicated too so it's not that. Help.

kindred widget
#

@shut loom There aren't any real ways to do that via RPCs I don't think. At least none in blueprint, I don't know about C++. If you wanted, you could use a replicated Variable set to a repcondition of skip owner.

vivid seal
#

Run on server > multicast > some kind of check to see if you are not the client that initiated the call, but multicasts are really only good for โ€œone-timeโ€ actions

signal lance
#

multicast and then check if the pawn is locally controlled

#

if it is locally controlled it means it is owning client

#

or if local role is Autonomous Proxy it's locally owned

#

multiple ways there

kindred widget
#

That feels like unnecessary bandwidth.

signal lance
#

@kindred widget why?
Having a replicated variable pretty sure takes more bandwidth than 1 time event
Depending on the params being passed ofc

quasi shoal
#

why is my client not joining the proper session when i leave it and then look for one again but there is only 1 session and it just than makes another one. Its fine if it makes another but only should happen if it didnt find one which it did.

#

The join session fail fires off so im confused why

#

Is this just mostly a editor client-server thing and acts different in a standalone?

signal lance
#

I would say that would be a job for a rep notify since it's something that should happen for everyone even if not currently relevant, when it becomes relevant again RPCs won't be fired again for that client while replicated variables will so everyone will see the same thing
In the repnotify function you can then decide what to do (setting visibility based on if it's owning client) @shut loom

fast arrow
#

Hellow guys, im studding NetSerialization and i stuck on one particular thing. Down is the part of the code that is in the article that i found.
bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
uint8 ByteAcceleration = FMath::Quantize8UnsignedByte(Acceleration);

uint8 B = (ByteAcceleration != 0);
Ar.SerializeBits(&B, 1);
if (B)  Ar << ByteAcceleration; else ByteAcceleration = 0;

}
i cant understand this part :
uint8 B = (ByteAcceleration != 0);
Ar.SerializeBits(&B, 1);
if (B) Ar << ByteAcceleration; else ByteAcceleration = 0;
why dont just if(B), but make this serialize thing ? What is idea behind it?

keen thorn
#

Hi has anyone tried the new "Network Prediction" Plugin? It seems to serve as a general clien side prediction framework

stark fractal
#

Okay so i found the problem after going through logs

#

it turns out the blueprint that i placed in world it doesnt have access to server. So i rerouted this function to the player controller and it works. So i really want to keep the function in the blueprint that doesn't have access so how to give it access after spawn?

#

one way is spawning it through game mode or Run on server, but is there a way to give it access after it is spawned?

thin stratus
#

Not without going through the server

#

It's common to route to the server first and then interact with the world

empty axle
#

Hi
Is it safe to assume that replicated actor that is placed on the level would exist in BeginPlay of some other actor?

pure flume
#

Hi, How to get Pawn from PlayerState? It comes with nullptr when use GetPawn()

stark fractal
#

@thin stratus I will just route it through the controller. cause the pawn i move is not possesed by controller, it is controlled by AI so it cant communicate directly to server when i trigger it from client controller. And my possesed pawn is camera pawn, it is strategy game camera. Ty for help.

muted perch
#

When my clients join the session they can't move. I have the fps template movement.

slim matrix
#

how do i do multiplayer sprinting in c++ because with BP if there is any sort of packet lag it stops working and I've head that doing it in c++ is the only way but i have no idea how to

hasty adder
#

anyone got craft ways for determining if input is held or if velocity is increasing vs decreasing - The Goal is... when pressing a direction i want the player to lean into it. but if not holding it and they're coming to a stop they lean against the velocity.. this needs to be known over MP - I can set a X and Y for the axis value and replicate that but i feel like there must be better way i can do this in the animation bp solely on if velocity is going up or down. but not sure how to get the relative nature of it.

hasty adder
#

ok hold the phone get current acceleration

twin juniper
#

if velocity is increasing vs decreasing -
@hasty adder
I think you should research velocity

jagged stag
#

What's a nice way to avoid loading the default player controller on a dedicated server? It gives me UI errors and whatnot and I don't know if there's a proper way to deal with this

winged badger
#

that would probably be because you initialize your UI from something thats not your HUD

#

or PC

gleaming niche
#

and surround it with #if !UE_SERVER

#

like what you should do with AHud if you're using that.

#

same thing applies.

#

(with AHud mostly just for the constructor)

#

like what shootergame shows.

jagged stag
#

that would probably be because you initialize your UI from something thats not your HUD
@winged badger I'm initializing it from the PC tho, when I debug it stops at the breakpoint 3 times, 2 for the 2 connected clients, 1 for the server

winged badger
#

PC exists on your dedi

#

HUD does not

#

its why its preferred way to handle UI, especially in a networked game

#

its instantiated from ClientInitializeHUD RPC under the hood, so only 1 HUD per PC exists, and only on their local machine

#

@jagged stag

jagged stag
#

you're right, thank you very much @winged badger

tulip yoke
#

Hi, i m testing a multiplayer attach to, simple linetrace and attach to headsocket. firsttime all worked well, then i changed my casts by a interface but then it failed so i put all back. strange now my repnotifies want work correct on the client side. always points back that he can not find the value, and when i check my detailpanel i see the references being set

#

its on version 4.22

hasty adder
#

Welp I think i'm just going to have to client side watch axis input and call events when the values are not zero to use in animbp to indicate input is being pressed. I'd imagine if its an enum for each axis.. x and y with 3 bits of + - or = 0 it shouldnt be too bad a thing in the long run

#

this shows my inexperience of course haha

#

we need ted talks on gamedev.

winged badger
#

to use acceleration, CMC has to be setup for it

#

by default, i think it just changes to max speed

next fable
#

Hello awesome UE4 gurus!
Another day getting crushed by multiplayer....
Anyone know how to do SetViewTargetWithBlend in a multiplayer setting?
I set up a basic toggle camera deal here.
It "works" except that when the server views client camera, it starts glitching, as if it's fighting the position. When client views server, it's fine. Any clues?

peak star
#

Can Android use OnlineSubsystemSteam?

#

I want to do cross platform play between Android users and Windows 64 users

gleaming niche
#

nope.

peak star
#

Hmm that's weird. There must be a way to implement it though. After all, Among Us can play between PC and Android when the PC is hosting. Must not be using steam to manage their lobbies.

#

I know its not a UE4 game but the online services dont care what you use to make your game afaik.

gleaming niche
#

probably not using steam authentication, or lobbies, or sockets at all.

#

or whatever the android thing is, is connecting on different socket.

peak star
#

Yeah probably not

#

What would you do to accomplish this goal I have, of achieving cross platform play over internet without requiring the users to have additional software or technical knowledge (just plug and play like it would be for casual gamers)?

gleaming niche
#

just don't use the steamsockets net driver, you can leave pc/mac/linux authenticating with steam, though you'll have to deal with matchmaking and stuff yourself though.

peak star
#

It is starting to look like I have to write my own Online Subsystem

gleaming niche
#

and then override agamemodebase::login so you can deal with two network ids

#

or don't use any steam authentication at all, just use it for nicknames on pc, and then use google play for.. the android ones, or something.

peak star
#

I don't need matchmaking for my game just a way for people who already know each other to find each other's game

gleaming niche
#

like don't use onlinesubsystemsteam

#

but include SteamShared, and the steamworks stuff for the pc version, so you can do the basic stuff.

peak star
#

Sounds like that would work if the PCs host but what if the android is hosting?

gleaming niche
#

could still do it, but if they press the home key or something it will die lol.

#

and if you need low latency could be an issue.

#

or use dedicated servers for all of it.

#

like gamelift or something

#

i actually was working on a cross-platform (android and windows) top-down space game years ago

#

using photon for networking.

#

never finished it though, lost interest. lol

peak star
#

Ok sounds like dedicated servers is the way to go.

What if for first release I am okay with LAN only? I was using OnlineSubsystem NULL and it worked perfectly until a few months ago and then suddenly Android cannot find sessions

#

I had it working cross platform and same platform over same Wifi lan but suddenly now it doesn't work. One reason seemed to be because Android started to think its local IP address was 127.0.0.1

Maybe there was something else too. I am told NULL OSS is not meant for production.

twin juniper
#

was i just talking with you?

#

Are you using the find sessions blueprint node?

#

onlinesubsystems still works fine for me.

peak star
#

Yes I am using the built-in create session, find sessions, join session and destroy session blueprint nodes

#

Hey does Epic Online Services support android crossplay with PC? Maybe it would be easier to get that working than to try to fix the bug in the java code the UE4 uses for private LAN ip?

#

But I don't think I was talking to you recently. Glad for any helpful info though

lost inlet
#

photon engine isn't .NET core? wtf

#

it requires windows servers to run on, .NET core on the other hand runs on linux without any fuss

#

into the trash it goes

twin juniper
#

I don't really know how you are hosting and creating your sessions.

#

but you need to do a few is valid commands which i do in the gamesessions

#

and then set your gamesessions under your game-modes

hybrid zodiac
#

Hi all, I have a bit of a problem with joining sessions. I want a dialog box to pop up and inform the user if their connection to the server failed, but the async JoinSession task always returns as successful even if the client fails to connect

#

The current setup is to declare a FOnSessionJoinCompleteDelegate handle and bind it to a function, then add that handle to the Session using AddOnJoinSessionCompleteDelegate_Handle

#

  ShowServerJoinPrompt("Attempting to join the server...", EPromptType::InfoOnly);

  bSuccessful = Sessions->JoinSession(*UserId, SessionName, SearchResult);```
#

The function bound to the delegate is this:

#

void UMasterGameInstance::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)

#

However, the Result parameter is always EOnJoinSessionCompleteResult::Success even if the join attempt fails

#

We are using the OnlineSubsystemSteam

#

Does anyone know why this is the case? I seem unable to detect when a player is unable to connect to a server because of this

timid moss
#

Is it considered bad practice to use a short delay to solve race conditions? I've always felt it's a bad way of doing things so I've never done it.

#

Assuming this short delay is not in the middle of gameplay and is only when the player spawns.

winged badger
#

it is

hybrid zodiac
#

@timid moss It is a bit of a bodge because you have no idea how long you need to delay for to be safe, and depending on what you're delaying it could lead to downstream problems when stuff isn't initialised when you expect

#

We had similar issues when attempting to resolve timing problems with arbitary wait times

timid moss
#

I just feel like it is worse to have the server wait on the client as an indication for proceeding.

#

via a Server rpc

wicked nimbus
#

Hey, quick question regarding beacons. I have a running Lobby Beacon associated with a Party Session. The Game Session is associated with a dedicated server.
I want to move the lobby/party to a player hosted server (from the dedicated to the player hosted). When the host travels to the new map the beacon gets destroyed. Would APlayerController::GetSeamlessTravelActorList work in that scenario? To keep the beacon and the beacon connection alive? Because I noticed the party session stays valid but not the beacon?

grim lintel
#

Hi all. Quick question: Has anyone any info on how to create a simple join / dropout menu for local multiplayer games?

fierce oriole
#

So whats the damn secret to making my AdvancedSessions game activate Steam? Im creating and joining sessions fine, but Steam wont load. added the steamapp_id.txt, im using the right game instance. Does it involve the Build/Target settings?

#

Do I need to setup Steamworks?

royal rampart
#

Hi I have a stupid question.. But is it normal that if you attach a child to a child of an actor it just doesnt exist/work?

#

that capsule is clearly there, but not in game..

#

if I attach it to the rootcomponent it works in game o_0

#

i just want that capsule to rotate towards the direction the player is looking ๐Ÿ˜ฆ

#

(and the capsule is purely used on client side, so no replication problem)

peak sentinel
#

as far as i know camera is not replicated

#

i might be wrong but if the base class is not replicated the childs are not replicated too

#

also i see your capsule name is "grabcollision" if you are using that for equipping/grabbing objects thats totally not a good way ๐Ÿ˜… try line tracing instead

#

but if you should attach it to camera rotation anyway, attach your capsule to "head" bone in mannequin skeleton @royal rampart

raw echo
#

Does anyone know if dedicated servers should appear on steam server list and in the in-game find sessions results even with the 480 test app id?

#

They appear on LAN and I can find and join them but they don't appear when I host them on a VPS, although I can connect to the server with open steam.xxxxx using the steam server id

royal rampart
#

but if you should attach it to camera rotation anyway, attach your capsule to "head" bone in mannequin skeleton @royal rampart
@peak sentinel Hey thanks for replying, i am not using it to grab something, for that im using a spherecast, i just wanted a way to give player feedback if the object is within "grabrange", I dont wanna raycast every frame.. plus it should have nothing to do with replication since it a fully offline check

#

and the camera is getting attached to the head of the character, maybe that's why the childs disappear??

peak sentinel
#

i dont think so ๐Ÿค” have you tried to attach it to mesh to test if its about the camera only?

kindred widget
#

Funny enough, tracing every frame is probably equally expensive, or even cheaper than relying on overlaps. And for that, you don't even need every frame. 15-20 times a second is more than enough.

peak sentinel
#

and of course its your way how to handle things in ue4 but just for opinion line tracing still better than checking for collision, in the back-end its consuming ticks and data too

raw echo
#

Yeah line tracing is not that expensive actually

royal rampart
#

really, okay, then ill do it with linetracing ๐Ÿ˜„

#

or capsuletracing?

#

is that fine too xD

peak sentinel
#

capsule has several lines to become a capsule lol ๐Ÿ˜„

royal rampart
#

yeah well, the grabrange is an area..

#

๐Ÿ˜ฆ

#

so a linetrace would only work in a way that youd actually have to aim at the object

#

that's why i was opting for overlaps

#

haha

raw echo
#

Probably more expensive, but don't know how much since I never used capsule/sphere traces

peak sentinel
#

use viewpoint to adjust your characters eye location then line trace from there

royal rampart
#

im just gonna spheretrace like 10 times a second?

#

is that okay?

peak sentinel
#

actually if its about range

royal rampart
#

well its about an area within a certain direction and range, hence the capsuletracing haha

peak sentinel
#

well if there isnt "certain direction" just a sphere collision would work ๐Ÿ˜„

#

i would just line trace every frame, and create bigger collision spheres for objects

#

that way instead of using capsule trace, my line trace would hit bigger collision spheres and it would scale the view

#

like this red collision sphere, make it bigger than mine so when camera gets close to it feedback will given to player

#

and there must be a "tick interval" setting in actors/characters bp, you can set it to 0,2 or 0,1 if you really having issues with performance

kindred widget
#

To be fair, you can manage the same range with a SphereTrace. Since it's effectively a capsule in itself.

#

Just need a short distance and a wide radius.

near bison
#

Hey guys.
I want to create 10 widgets (corresponding to 10 players) for my client. However, my widget asks me for my owning player, so I guess I have to pass each person's player controller, which I don't have access to.
Any suggestions?

peak sentinel
raw echo
#

What do you want to achieve with that?

peak sentinel
#

but accessing their index and select the specific one? no idea

#

its on gamemode btw

raw echo
#

I was making like a name display overhead yesterday so I can show you that if that would help

peak sentinel
#

im interested in that too @raw echo

raw echo
#

Only tested on dedicated server though

#

Now I can't promise the code is good ๐Ÿ˜„

#

Sets every player's name for every client

near bison
#

So what I'm trying to do is a voting system (similar to Among Us)
I jsut want to list all the players and have references to them

#

If a button is clicked, I want this reference to the player to run some operations.

The general idea is: I will update my playerState with all the consolidated votes cast against that player. Any suggestions will be great

raw echo
#

This is OnPostLogin

And pretty much on the repnotify it sets he 3d widget's text to the name

#

Not sure what is the best way to do a voting system, my first idea is usually the worst way to do it

near bison
#

@peak sentinel why would I store a list of all player controllers

peak sentinel
#

Hey guys.
I want to create 10 widgets (corresponding to 10 players) for my client. However, my widget asks me for my owning player, so I guess I have to pass each person's player controller, which I don't have access to.
Any suggestions?

#

To get access to them

near bison
#

but I can't get access to the one I want when creating the widget. I mean, how will I know? There might be some inconsistencies

#

This will give you a better idea of what I'm trying tod o

#

But that Get Owning Player is wrong. Because I'm passing the same owner to all widgets

raw echo
#

You don't have other players controllers

#

On client

peak sentinel
#

i guess you should make variables in widgets and expose them on spawn or create a function to get variables from where you create widgets

near bison
#

Well yeah, sure. I can store all controllers.
But again I'll have to filter to make sure it's the right one that's being passed to the widget. A lot of overhead

peak sentinel
#

create the widget on server, it should create for everyone but the variables like who voted, voted for what etc. should get from the controller itself

#

server should replicate them by default

near bison
#

that's a good idea

#

to add on to that:

#

create widgets on the server.
when client clicks on widget created by server, send the client's choice up the server, and then the server updates game state

peak sentinel
#

which class do you use to create the base widget? not the childs

near bison
#

I create it in the HUD

peak sentinel
#

HUD is client only as far as i know

near bison
#

hmm,
I think I should
create a pawn class -> RPC to server to create the base widget

peak sentinel
#

create a pawn class to only create a base widget?

near bison
#

is the server supposed to multicast the call or is the widget creation replicated to everyone by default

#

the pawn is also handling my camera

peak sentinel
#

shouldnt you use gamemode?

near bison
#

to do what?

peak sentinel
#

create the base widget

near bison
#

lol I don't understand Unreal Gameplay Framework sometimes

#

wait what's the reasoning to create it in Game Mode

peak sentinel
#

custom event > create widget > promote to variable (reference) > create custom events for specific events like voting > gamemode is accessible by everyone and its server-only so you can use gamemode to replicate the votes

raw echo
#

Oh damn

near bison
#

i've read the compendium

peak sentinel
#

you should do the add child events in gamemode too, i guess

near bison
#

it doesn't feel right to do this in game mode

#

isn't game state better for this

peak sentinel
#

i might be wrong, but if you dont need to multicast or use client-side functions gamemode is okay

near bison
#

yeah but it doesn't make semantic sense to do it in game mode

peak sentinel
#

you will handle the input events and send data to server from your pawn or controller, you will create widgets from your server, so gamemode is server-only it should be fine

#

doesnt matter

#

gamestate works too

near bison
#

actually I thought of gamestate, but here's the problem

#

in gamestate I'll have to store a map where key is playerId, value is an array of playerIds (who has voted for this particular player)

#

but I can't seem to create a map where the value is an array

peak sentinel
#

why do you need that?

near bison
#

how else will I tally votes

#

I don't want votes to be an integer, I'd rather it be a reference to the player no? In case I wanna show who's voted for who

#

At some point in the future

peak sentinel
#

oh okay

raw echo
#

Create a Blueprint Struct, add an Array to that and use that as the Map's Value?

peak sentinel
#

something is wrong there but cant say something because i am not a professional at all lol

near bison
#

bad idea @raw echo, there'll be infinite array duplication without being cleared up

#

I've contemplated doing that

raw echo
#

Well sure but it's probably impossible to do it in any other way

#

Or you could just re-think the whole thing

peak sentinel
#

you wanna broadcast who voted, right?

near bison
#

other thought is just store who's voted for a player in that player's PlayerState. Simpler, cleaner

raw echo
#

And store it in another way, maybe store every player's vote as a separate array value

near bison
#

What do you guys think? This is instead of GameState

peak sentinel
#

playerstate is "player" state i guess no

raw echo
#

I mean that should work?

peak sentinel
#

gamestate is "game" state its also no ๐Ÿ˜› maybe i should insist about gamemode

#

afk for 5 mins, gonna come back

near bison
#

@peak sentinel it's playerState, but it is replicated

raw echo
#

You can store everyone's received votes in their playerstate on the server

near bison
#

it's replicated already, I don't need to store on the server

#

once time elapses, I can just Get all player states and tally votes

raw echo
#

Yeah that sounds good

near bison
#

this should be fine, yeah
but this still isn't solving my original problem tho. the widgets not having access to the controllers.

Should I just go ahead and create the widgets on the server then?

raw echo
#

I've never actually created widgets on the server so I have no idea, but I guess that would work

peak sentinel
#

the problem is you cant access the widgets nor controllers from widgets

#

you should access the widgets reference from an accessible class

#

then do your logic there

#

playerstate, gamemode, gamestate doesnt matter

near bison
#

So I guess I'll create it in GameMode, create references to each widget (tied with reference to the player) and then run some logic there I guess

peak sentinel
#

you mean a widget for every pawn for "each widget" or you mean every widget you have on server?

near bison
#

Not sure what you're asking

peak sentinel
#

nvm, the workflow you said is true it doesnt matter anyway

echo snow
#

Do I need the blueprint to replicate in order to have an rpc to work?

chrome bay
#

yeh

echo snow
#

Alright thanks

peak sentinel
zinc owl
#

Best suitable Third party for handling realtime multiplayer mobile shooting game in unreal??? plzz anyone help...........

#

like Photon and so on...

#

plzz help

echo snow
#

@peak sentinel did you check if the problem is in the widget

#

or not

bitter oriole
#

@zinc owl You don't need a third party multiplayer system.

zinc owl
#

@bitter oriole Then how I handle online multiplayer...??

bitter oriole
#

Using Unreal's built-in multiplayer

jagged stag
#

This is a bit of a noob question but I'm new to multiplayer, should I put my code that tells connected PlayerControllers to possess pawn inside of a GameMode or a GameState?

raw echo
#

You can do it inside gamemode

fossil spoke
#

@jagged stag Possession of Pawns happens on the Server Side, so your GameMode is a better choice.

jagged stag
#

thanks for the replies, just to understand better, I thought the GameState would be more fitting because it replicates to all clients, I was thinking of the GameMode as something that should mainly work on the server logic and not interact with the PlayerControllers too much.

fossil spoke
#

Possession of a Pawn is automatically replicated, it does not need to occur on a particular class in order for this to happen.

#

As long as its happening on the Server, the PlayerController doing the Possessing will handle updating the Client.

#

The GameMode already has functions for handling Pawn Possession as well.

#

In C++ at least.

jagged stag
#

Thanks, it's a lot more clear now ๐Ÿ™‚

plucky sigil
#

Why is it that getting PlayerStates data from PlayerArray as a client, it is different to Server Data ?

winged badger
#

they are the same playerstates

#

they are usually not in same order

#

and only replicated data should match @plucky sigil

meager fable
#

when testing multiplayer in a non packaged game, by right clicking the uproject file and selecting launch game do the games need to be built on the same engine version?

#

bc when I host a game on my PC and run a second instance in the new window I can find the match but when I search for it on my laptop there is nothing

peak sentinel
fossil spoke
#

@peak sentinel Because your RPC is being run on the Server side. PlayerControllers can only ever be LocallyControlled on a Client machine, hence the name "Locally" Controlled....

peak sentinel
#

i thought the "locally" thing is about inputs ๐Ÿค” i understand better now thanks

meager fable
#

when testing multiplayer in a non packaged game, by right clicking the uproject file and selecting launch game do the games need to be built on the same engine version?

#

In case anyone was wondering

#

yes you need to build on the same engine version

empty axle
#

yes and generally if you change some stuff regarding replication then you also have to update the build

earnest solstice
#

Can same one help me what I'm doing wrong? ---> Increasing per-process limit of core file size to infinity.
Preparing to exit.Shutting down and abandoning module NetworkFile (12)Shutting down and abandoning module CookedIterativeFile (10)Shutting down and abandoning module StreamingFile (8)Shutting down and abandoning module SandboxFile (6)Shutting down and abandoning module PakFile (4)Shutting down and abandoning module RSA (3)Exiting.Exiting abnormally (error code: 1)

near bison
#

How would I pass each respective Player Controller here, instead of Owning Player Controller?

#

Trying to make sure each child item is bound to the respective playerController

bitter oriole
#

Why is this a multiplayer question ? widgets should always be client side only

near bison
#

Because the widget I'm creating for my client is a list of buttons with each connected player's player name

bitter oriole
#

Player names are replicated to all players out of the box through player state.

near bison
#

there's more than that
the client has to be able to click on one of these buttons to perform an action, and I need the clicked player button's reference to do some computation

bitter oriole
#

Move that logic to the player controller if it needs networking

#

Widgets have no business being replicated

near bison
#

ok just 1 question

#

when I click on a button (with the respective player's name), how do I get a reference to that player?

#

from the widget

bitter oriole
#

That's very easy : since you are using the Player State to get the player name, and player state is replicated, you can just use that player state in your call to the server method

#

Basically store the player state for each button, get the name from that for display

near bison
#

but that's the thing, how do I know which player state corresponds to which button?

#

Basically store the player state for each button, get the name from that for display
@bitter oriole how do I do this

bitter oriole
#

You would create each button from a player state

#

On the client

near bison
#

isn't that what I'm doing in the BP? for each player state, I'm creating a button

#

but I can't pass the playerState into the widget

bitter oriole
#

Then you just need to store the player state into your button class, or map buttons to player states

near bison
#

map buttons to player states how? via indexes? that might lead to inconsistencies if the buttons are rendered in different orders on different clients

#

Then you just need to store the player state into your button class, or map buttons to player states
@bitter oriole how would I do the former

soft girder
#

If it's a single widget I would just create a function in the widget to change the name onrep

bitter oriole
#

@near bison Say it with me : widgets are client side only, they should never be replicated, ever

soft girder
#

^^^^

bitter oriole
#

Now on each client, and I say client

#

You create a button for each player state

soft girder
#

Replicate the string from playerstate

bitter oriole
#

No, there is nothing to replicate at all

near bison
#

there's nothing to replicate

#

playerState is already replicated

soft girder
#

I might misunderstand what the widget is for

bitter oriole
#

So you create a button for each player state, you store the player state in that custom button class

#

You get the player name from the state in the text callback

#

And when the button is pressed you use the player state as parameter to your server parameter in player controller

near bison
#

"store the player state in that custom button class"
how? if I get the answer to this, I think I'm done

#

sorry I'm very new to UMGs and widgets

bitter oriole
#

Create new button blueprint, create player state variable, set player state variable

#

Or do that processing in the parent widget

#

Using a map from button widget to player state or something

near bison
#

ok, so I created a new blueprint for button

#

created a variable which is of type PlayerState (my player state)

#

where do I call the setter though? this is where I'm confusde

#

while creating the button widget?

bitter oriole
#

Sure ?

soft girder
#

Can I ask what the button does

bitter oriole
#

Sure ?

#

Another option is to set an index to each button, and then have each button show, in the text callback, playerArray[index]. If index >= playerArray.Num(), then button is made invisible.

#

This way you also handle disconnections

#

You then send the player state to the server as usual (this step has to be done that way)

near bison
#

@soft girder the button displays connected player names, and I'd also like to call functions when a button is clicked by a client

soft girder
#

Like mute etc. I see

#

I thought you were just making a widget to display player joined for some reason

near bison
#

one sec I'm still confused with the very basics.
how do I set a variable for the button after creating the widget??

bitter oriole
#

You would create a setter function and call it

soft girder
#

@stranger is he creating a new instance of this blueprint for ever button?

bitter oriole
#

That's the plan

soft girder
#

Couldnt he set the blueprint to instance editable and set the variable to expose on spawn

#

So when he sets the spawn node to that blueprint there should be an input

#

For the variable

bitter oriole
#

Just use a regular dumb function like everyone else

soft girder
#

Lol

bitter oriole
#

There is no need to make it complicated

near bison
bitter oriole
#

Yup

near bison
#

ok, last small error

#

Blueprint Runtime Error: "Accessed None trying to read property BP_PlayerStateButton".
Is it because there's nothing being passed as an asset to BP_PlayerStateButton?

soft girder
#

There is nothing being passed to the setter

#

It doesnt know which one

near bison
#

Yeah, my bad. I should just use the getter instead

soft girder
#

Where is that bp getting spawned?

#

When I get home in a couple of hours I'll be able to sit down and take a better look

#

I'm at work right now

near bison
#

I got it to work, no problems

#

Each individual button is being passed PlayerStates

soft girder
#

Nice

near bison
#

Ok, more problems! ๐Ÿ˜„

#

On one client, it's showing the names (but all buttons have the name from the same player state), and on the other, nothing at all

bitter oriole
#

Well, how are you getting the text ?

#

Should be playerstate->playername in the text callback

near bison
bitter oriole
#

Is that the text callback from your button Blueprint ?

near bison
#

Yes

bitter oriole
#

I'm confused by that "BP Player state button"

#

Should be able to just read the variable directly

near bison
#

You told me to create a new Button right

bitter oriole
#

Just read the variable directly

#

The player state

#

In the button class

#

Your "BP Player state button" variable is in the parent widget and it's useless

#

Since it's going to point to the last button created, al lthe time

#

You can remove it and jus tread the playerstate from the button blueprint

near bison
#

wdym by read playerstate from the button blueprint?

#

It's not there in my list of variables, in my widget, if that's what you mean

bitter oriole
#

Your button blueprint has a player state variable that you created minutes ago, along with a setter

near bison
#

Yes, it does

bitter oriole
#

That's in the button blueprint, right ?

near bison
#

And this is how my Widget looks

bitter oriole
#

So now in the button blueprint, the callback for the text should just read PlayerState -> name

#

Not in the widget

#

In the button blueprint

near bison
#

Where can I access the callback to set text for the button blueprint?

#

In the button blueprint itself? And what node am I supposed to use?

#

See that's what I'm confused about. How does the PlayerStateButton know about its child outside of the context of the widget?

bitter oriole
#

What do you mean,"child" ?

soft girder
#

Textblock

near bison
#

Check the latest screenshot. Only in the Widget does the PlayerStateButton have the child of Textblock

bitter oriole
#

Look

#

Create a widget blueprint, add a button, a player state variable, a set player state method, and map the button text to a callback that reads the name

#

Then put widget in your own widget, and call the method

#

It's like seconds of work

near bison
#

That widget blueprint is called PlayerEntry, it's using a button with a custom BP (PlayerStateButton), that has a getter and a setter for player state, and the callback is bound to the textBlock which is the child of the button

#

idk what I'm missing

soft girder
#

Hey

#

Real quick. The name thing might be a bug in the editor.

#

Our names only work when we are playing on compiled copies

bitter oriole
#

No it's not

near bison
#

Is my hierarchy an issue? Should I remove the PlayerEntry size box and make button the direct child?

soft girder
#

When we test in editor everyone's name is the same as host

bitter oriole
#

Your "custom BP" is a widget blueprint right ?

near bison
#

omg

#

wait, you want me to create the player state variable in the widget????

#

I've created the player state in a child BP that inherits from Button, and added that button in my widget lol

bitter oriole
#

What you did is correct

near bison
soft girder
#

In that screenshot with the names which one is server?

bitter oriole
near bison
#

I'm playing as client @soft girder

#

not listen server

bitter oriole
#

Your UI widget Blueprint for the button should have a button, a text field, and map the text field to the player state

#

Just the way I show here

#

That's the custom button clas

soft girder
#

Are both veiwportz clients?

bitter oriole
#

This is the setter

#

Then your user, parent widget can add buttons

near bison
#

Are both veiwportz clients?
@soft girder PIE

bitter oriole
#

And then your parent widget graph does this

#

Except in a loop

#

You can do it dynamically th way you did too

#

It's just that simple

soft girder
#

@near bison do you have a second machine to test with on lan?

bitter oriole
#

Please stop

#

His problem is basic UMG beginner stuff

#

@near bison What does your child Blueprint class look like ?

#

Screenshot from the editor window

near bison
bitter oriole
#

Alright, that looks fine

#

Show the graph view now

#

Should be just the setter

near bison
bitter oriole
#

Alright

#

So this is okay

#

What does the parent widget blueprint graph looks like now

near bison
#

Actually I don't even think I need this function now, cause I put PlayerState as a variable of type PlayerState

bitter oriole
#

Remove that "bp player state button" thing

near bison
bitter oriole
#

You need to call the Set Player State function

#

Ah, sorry

soft girder
#

I think he meant the cast node

bitter oriole
#

I misread the original graph I think

near bison
#

shall i give this a shot

bitter oriole
#

The previous one was fine too i think, sorry

#

Both should work

near bison
#

ok gonna give it a shot now

#

Same issue still. Could it be that my playerstate doesn't even have the proper name

soft girder
#

Where does the playerstate get the name?

near bison
#

But that's not possible right? Cause it's displaying on one client and not on the other

#

I'm setting it manually, in the lobby

soft girder
#

When you set it does it update the chang3?

near bison
#

And don't worry. It carries over. I'm using CopyProperties to make sure it's on the main level too (using Seamless Travel here)

#

yes

soft girder
#

Kk

bitter oriole
#

If nothing shows you should keep the player state name untouched to confirm whether the UI, or your name changing, is the problem

#

Setting the name manually obviously has to be done on server

near bison
bitter oriole
#

See, the UI part was quite easy

#

Now you just need to fix your name changing

near bison
#

Yup

bitter oriole
#

(By the way, Steam etc will set the name automatically)

near bison
#

this is a different player name btw. One that I'm gonna have the user set in game

#

like, username

#

This was great! Thank you so much @bitter oriole (and @soft girder)

#

Looks like I was unnecessarily complicating things. Forgot that a widget at the end of the day was an object, and I can directly set variables there for later, I guess

soft girder
#

@bitter oriole does your online subsystem work in PIE

bitter oriole
#

No OSS works in PIE

soft girder
#

We have always had to launch stand alone and then sometimes we have to just package the thing to test things that PIE. Some of these things are not just oss related

bitter oriole
#

Packaging is not needed, just right click your uproject file and hit Launch.

#

OSS don't work in-editor

soft girder
#

I'll have them try when we test new guns and stuff later

meager fable
#

does every player on the server have their own game instance object or is there a global game instance for every player?

bitter oriole
#

Each client has a game instance

#

It's a persistent object that is never replicated

meager fable
#

thanks

peak sentinel
#

@meager fable https://youtu.be/whow14uFWtw?t=392
there is a visual explanation on the video if you are interested

BRY

๐ŸŽฎ Unreal Engine Replication Series - Part 2: Game Instances

In part 2 of our replication tutorial series, we are introduced to the idea of game instances - not to be confused with the "Game Instance" class that's built in Unreal but the idea of multiple instances of the game ...

โ–ถ Play video
meager fable
#

thanks a lot, will definitely watch

hybrid zodiac
#

@meager fable Basic high-level breakdown:

Game Instance = Exists for all players and server - Not replicated
Game Mode = Only exists for authority in multiplayer games (or standalone) - Not replicated
Game State = One copy exists for all players and server - Replicated
Player State = Multiple copies (one for each player) exist for all players and server - Replicated

So this is how I tend to use them:

Game Instance - Fundamental config and running of the game that you need to persist across sessions (i.e. is not lost when changing the map in a multiplayer game) but you DON'T want synchronised. In our game we use it to determine how many bots should be added to the server for example. Clients don't need to know, but we need that number to persist throughout the uptime of the server and not be lost when changing game mode, map etc
Game Mode - All the mechanics for running the current session only, such as handling respawning, determining when to end the match and declare a winner, handling mid-game joining and setting up the game states
Game State - All game-related information you need to present to the players during the current session, such as team scores, objective status, which team is the winner and so on (not player scores and status, that would be in the Player State!)
Player State - All player-related information you need to track during the session that is not tied to the current pawn being controlled (i.e. persists when the player is killed and waiting to respawn), such as the player's score or their chosen loadout

meager fable
#

@hybrid zodiac Wow this is so beautiful imma save that on my desktop for future references. Huge thank you for taking your time to write that down

hybrid zodiac
#

@meager fable You're welcome ๐Ÿ™‚ It can be a bit confusing and I have to admit we have a bit of cross-contamination in our code base where stuff that should be in the Game Mode is in the Game State etc. The drawbacks of learning as you go along ๐Ÿ˜›

peak sentinel
#

How can I access clients HUD class?

#

I am updating the widget from HUD class but its calling the servers HUD everytime

#

get actor of class is calling the first class in the world, but since HUD is client only, it should be get the servers HUD when its a Client RPC?

umbral geyser
#

The second gun on the right side should be showing the same mag as the second on the left but it doesnt and the count should be the same but it isnt
Help please
Left side is server
Right side is client

winged badger
#

@peak sentinel if you get HUD on the server, you get server's HUD

peak sentinel
winged badger
#

depends on the object its called from

peak sentinel
#

so the problem is getactorofclass not the rpc

winged badger
#

only problem with getactorofclass

#

is that there is always a better way to access the HUD then that

#

btw, when you share screens, try to do so so the blueprint name is also in the screen

#

because its almost always relevant

peak sentinel
#

i am calling from playerstate then HUD then the widget

hybrid zodiac
#

@peak sentinel From what I can see, you want the client's HUD to show a different amount of money (presumably after being awarded some or spending some?). Would it not be better to have a replicated "money" variable in the player state and the HUD simply displays whatever that value is? Then the server just changes how much money the player has, it's replicated to the client's player state and the client's HUD just displays that amount?

#

I can't think of a good reason why the server would want to directly manipulate a client's HUD, unless I'm misunderstanding what you're trying to do

#

@umbral geyser Make sure the gun actor is set to replicate, the ammo count is a replicated variable, and that the actor gun is relevant for that client. If all 3 of these things are correct then the ammo count should be automatically sync'd between server and client

umbral geyser
peak sentinel
#

@hybrid zodiac i thought that was what i actually do, but.. not sure ๐Ÿ˜…

#

playerstate has a replicated variable "money" and it sends the money value to HUD to display it on the players screens

#

CharacterBP changing the value then sends to playerstate variable

hybrid zodiac
#

Ok in that case you don't need a Client function to do that, in the HUD just bind the money text object to a function which retrieves how much money the player currently has

#

So it just displays whatever is held in the "money" variable

#

Then just change that money variable on the server

#

@umbral geyser Sounds like you need to establish first if there is a replication issue and the client really is seeing the wrong amount, or if it's a HUD issue and the HUD isn't displaying the correct amount

peak sentinel
#

Understood. I was trying to avoid Bind event since its ticking, but if that will help i can use it in the end

umbral geyser
#

@hybrid zodiac I'm more of focusing on the actual mag look not the amount

hybrid zodiac
#

@umbral geyser Oh sorry I misunderstood, in that first screen shot they had different amounts so I thought you meant the number of rounds in the mag wasn't syncing properly

#

How are you currently changing the look of the mag?

#

Just setting the mesh to something different?

umbral geyser
#

I have it on event begin it chooses a random number between 0 and the amount of mags to choose, then depending on the number it chooses, the mag look then it gets the mag and sets the mag size and fire rate depending on that

hybrid zodiac
#

Ok so here is what you can do. Make that random number a variable (if it isn't already) and set it to replicate, and also have an OnRep function

#

In the OnRep function, run your code to choose the mag based on the value

#

Make sure you also manually call the OnRep function on the server when it sets the value

#

Since OnRep is usually only run on clients

#

What will then happen is that the client will update the mag on their copy of the game every time that variable changes

#

@peak sentinel Binding a function shouldn't cause any performance issue, especially since in this case all it should be running is Get Player State -> Get Money Value -> Convert to FText

umbral geyser
#

@hybrid zodiac How do i access the server blueprint?

peak sentinel
#

Okay thanks ๐Ÿ™‚

hybrid zodiac
#

@umbral geyser In your BeginPlay event just do switch on Has Authority and set the value if Has Authority is true

#

That way the value is only set on the server's version of the blueprint and not the client's

umbral geyser
#

Didnt work and now the client isnt showing any mag

hybrid zodiac
#

Did you set the variable to be RepNotify?

umbral geyser
#

Oh i put it on replicated

#

Let me try that

#

Nope still the same

hybrid zodiac
#

So when you mark a variable as RepNotify and compile the blueprint, it will automatically create a function called OnRep_VariableName in your list of functoins, make sure you open that function and set the mag appearance there

umbral geyser
#

Ah ok

hybrid zodiac
#

Something like that

umbral geyser
#

How do i call the function?

hybrid zodiac
#

You don't call it, it is automatically called every time the client detects that the variable has changed

#

So what happens is server changes the mag selection variable -> replicates it to client -> client goes "oh this is rep notify, I better run RepNotify_MagSelectionVariable"

umbral geyser
#

Okay

hybrid zodiac
#

and then RepNotify_MagSelectionVariable changes the mag, so now the client should have the same magazine as the server

#

However, as I said, RepNotify functions are NOT run on the server, hence why in the picture above the server runs the "set magazine appearance" function manually after setting the variable

#

Otherwise the client will change their mag correctly but the server won't

umbral geyser
#

So its working if i run a dedicated server but then a new problem appears

#

The second client's mag sometimes doesnt show

hybrid zodiac
#

Strange, it should work for all clients. Any time any client's mag selection variable is updated by the server it should just run that function and change the mag

#

Not sure why it wouldn't for one client

umbral geyser
#

With the random integer in Range does 0 count as 1?

hybrid zodiac
#

Yes, 0 is the first element in the array

umbral geyser
#

Okay

hybrid zodiac
#

So to pick a random option you need to use a range of 0 -> Number of options - 1

#

So if there are 4 possible magazine types, then the random integer needs to be 0-3

umbral geyser
#

Yeah done that but still shows no mag sometimes

hybrid zodiac
#

Make sure all your options have a mesh assigned and stuff

umbral geyser
#

Yep they do

hybrid zodiac
#

Maybe test by setting the variable to a fixed number and try each one

umbral geyser
#

Okay ill try that

hybrid zodiac
#

See if it's one particular option that isn't working, or if it's randomly not showing properly

umbral geyser
#

Okay

#

Its 0

#

It has a mesh assigned and everything but doesnt show

#

I added a blank element to 0 and moved everything up one and it works so far

#

@hybrid zodiac Thank you so much for your help

hybrid zodiac
#

You're welcome ๐Ÿ™‚ Glad it works now

knotty folio
#

Hello everyone,

I want to do something like, consider for multiplayer like while game begins I've one character/actor, once this character/actor pass through some door or some region, it will create all players. Like initially when game play only one player is spawn, now as soon as this passes this region it get all players and spawn all connected or join player. If four player than four come if eight player is playing than eight player created by that one actor

oak hill
#

There's some built-in method to restore data on the client after the server load a saved game? For now I'm sending a binary array to client, but I'm not sure it's the right way to do it

soft relic
#

This can vary based on what kind of stuff server loads, but in most cases I think you'll have to pass that manually (as long as its not already replicated and handled properly on client side)

near bison
#

Does player state have any unique identifier I can use? Using online subsystem (advanced sessions plugin)

oak hill
#

@soft relic Yeah, the fact is that not all properties are replicated, so basically I send the data to the client and it deserialize on his own

#

@near bison advanced session let you retrieve the player unique id if I remember

near bison
#

From player state?

oak hill
#

from player controller

tranquil yoke
#

Hey guys, i want to create a reconnecting sequence for my, Game, Where if player is disconnected , player should re try to join the server. With out leaving the map .

And server seems to disconnect player , if the application loses focus for a small amount of time like 20 to 25 seconds, how can i increase this time limit

near bison
#

Assume I don't have player controller @oak hill. I only have player state

#

I need to do this on a client. And I can't get all player controllers on a single client

oak hill
#

if you're on c++ simply call GetUniqueId from player state

#

there's no equivalent for BP that I know

jagged sundial
#

Hello

#

this works for local player to add the widget to the local player

#

but it does not work for the secondary player

#

Is there anyway to get all the player controller

near bison
#

@oak hill I don't think what you're saying is possible

oak hill
#

What exactly?

near bison
#

Nvm. Done

#

Quick question tho: what if I don't use Advanced Sessions?

oak hill
#

To get the player id?

near bison
#

yes

#

also, is it possible to get the player state from the ID?

oak hill
#

like I said before, call GetUniqueId from player state

#

to get the player state from the id you could iterate through all the player state and find the ps that match what you passed

jolly meadow
#

anyone know

#

why physics actors doesnt update

#

in IP multyplayer

#

but collision does?

pearl vessel
#

Where does the code live for Characters that decides whether or not to fire the OnLanded event?
edit: Found it in CharacterMovementComponent.cpp

twin juniper
#

i have a actor that executes logic in client side, and i want send a event back to the server, how i can do it without create dependency inside my character or controller class?

steel vault
#

Someone correct me if I'm wrong, but I believe that as long as your actor is set to replicate and you call SetOwner(Character) for that actor, sending in the owning character/player controller you should be able to call an RPC straight from that actor just fine. @twin juniper

twin juniper
#

will try

winged badger
#

if the SetOwner is called on Server

jolly meadow
#

anyone know
why physics actors doesnt update
in IP multyplayer
but collision does?

steel vault
#

@twin juniper Zlo corrected me, make sure you (HasAuthority()) when you SetOwner()

craggy quiver
#

Can someone help me make a respawning system for my Multiplayer project, im having some issues with player index

craggy quiver
#

Im trying to go for a setup where I destroy the character the player is using on death, then try to posess it with the correct idex when respawning it

winged badger
#

best to avoid using controller/player indices

#

they can shift if someone drops out

zealous saffron
#

Death Event -> UnPosses, etc -> then have the playercontroller request a respawn from the gamemode.

#

No need to keep track of indices.

craggy quiver
#

doesnt getting the controller require an inde

#

x

#

My main issue is that I dont know how to send a request as a player controller

zealous saffron
#

Have it pass itself as an argument to the game mode.

craggy quiver
#

Is there an example I can look at somewhere

#

of how to pass it as arg

#

Im not sure how different that is than casting to thirdpersoncharacter

vivid seal
#

did they change the Net PktLag command?

#

i see NetEmulation.PktLag but it doesnt seem to work

meager fable
#

is there a way to get the owning player controller/player state in a game instance?

bitter oriole
#

There is no such thing

#

Game instance is unique, player state and PC are not

tulip yoke
#

Hi, quick question, a array variable you can replicate but on a map (key/value) you do not have the option to replicate is it wise to use this in a multiplayer setup?

#

should i better create them myself ?

#

or maby create a special struct to store the values

near bison
#

you can use tarray or maybe multicast the map

#

or maby create a special struct to store the values
@tulip yoke this works too I guess

tulip yoke
#

i'm just thinking as i'm new to multiplayer but i have it working now but i see if i want to switch its better to store the 2-3 values like a actor/bool/and socket

#

i'm building a mountsystem and i started on a Actor class to understand all and then work my way up on character and wheeled vehicle

#

actor i have fully working

#

its done in BP not c++

limber gyro
#

kinda of a vague question but , how do you debug diferent behaviours in the server and the editor?

#

i have a wall spawning in a diferent place when i test in the editor

earnest solstice
#

can i use ipv6 with dedicated server ?

limber gyro
#

and when i have a remote server and connect it spawns slightly higher

tulip yoke
#

@near bison i created a struct and put the 3 arrays in and that seems to be working better then using a map

#

thx

near bison
#

awesome @tulip yoke! Glad I could help

near bison
#

Why is my variable in GameState not replicating? If I click on a button on different clients to update it, it doesn't update

kindred widget
#

@near bison If you're talking about NumberOfVotesCast, it's not set to replicate.

near bison
winged badger
#

that has nothing to do with variable replication whatsoever

near bison
#

Forget the variable replication

#

I'm calling this event on my client, why isn't the Hello printing on my server's screen?

vivid seal
#

Are you calling this inside something the player owns (player controller, controller pawn, etc.)?

lime wren
#

hey somebody can explain me game mode

#

in multiplayer

#

in my game

#

when u enter u are spectator

#

when the server click on F8

#

everybody will be a normal player

#

but how i do this

#

with possess ?

#

please

ruby rock
#

Hello. I'm struggling with what look like timing issues, but might be my lack of knowledge around MP code.

I have my game mode set to have no Default Pawn and OnHandleStartingNewPlayer, am spawning a new pawn and then calling Possess.

This seems to work OK - but when I start trying to use that Pawn (OnClient) I get mixed results. Perhaps the actor is still replicating from the server? For instance I try to add some widgets to it, or try to disable input sometimes I'll have a null Pawn.

Is the solution to use delays, or perhaps have some sort of loop/callback?

hybrid zodiac
#

@lime wren Game mode only exists on the server, so all you need to do is write the code to spawn a new character for your player to possess and then possess it. Possession is automatically replicated so you don't have to do anything on the client

#

So you could override the post login event to spawn the character and possess it for the new player controller

#

Or you could set a timer to do it, and replicate some state back to the player so their client can display a "waiting to respawn..." message or something

near bison
#

@vivid seal nvm, you can't make server RPCs from gamestate

lime wren
#

@hybrid zodiac i need to make a function in my PC to possess new pawn ?

#

Like :

#

ChangePawn() -> Spawn a new pawn -> Possess it

hybrid zodiac
#

@lime wren I suppose that depends on what you want to do and how to structure your code, but for basic spawning a playable character and spawning it, it would look like this:

lime wren
#

i will show you

#

When you start playing on my game

#

everybody is a spectator

#

you see

#

When i click F8

#

I want all my "specs" became player

#

player pawn

#

to play

hybrid zodiac
#

So in that instance I would write a function in the GameMode called "SpawnAllPlayers" or something, which iterates through all player controllers, spawns a new instance of the pawn you want the players to have and possess them

lime wren
#

make something like this

#

but it doesnt work

#

only the server spawned correctly

hybrid zodiac
#

You're spawning all the characters at the world origin, maybe the characters after that are failing to spawn because that first character is in the way?

thin stratus
#

Given the collision handling, I would assume the same

hybrid zodiac
#

You can either set the collision handling override to "Always Spawn", or add some offset to the characters so they don't all spawn inside each other

thin stratus
#

Your Possess is also not connected to the Pawn

lime wren
#

You were rights

#

just tested like that and it work

thin stratus
#

Ah wait, you fixed that already (the pawn pin)

#

Yop

lime wren
#

Yes the problem was, like you say the pawns cant spawn

thin stratus
#

Time to write a spawn point system :P

lime wren
#

because te "origin"

#

Yes i will do that lol

#

its not so complicated .. xD

hybrid zodiac
#

@lime wren Glad it's sorted and good luck!

lime wren
#

Yes and thank you ! ๐Ÿ™‚

cloud parrot
#

I asked this from the cpp channel, so sorry for posting it here as well. Maybe my question could be more relateable on mp channel as I didn't get any responses from cpp:

Sorry to bother again. I asked earlier about Root Motion Source and how to take control over a character in a multiplayer environment by code. My original question was is RootMotionSource the way to do it? Currently I am setting actor location but I don't think that's gonna fly in MP.

I have tried to setup RootMotionSource and it seems to get triggered since animation is on correct state but the translation does not happen as it's "on the place". Any ideas what gives?

#

this is getting written to the log:

LogRootMotion: VeryVerbose: Adjusting SimulationTime due to Duration reachable partway through tick before Preparing RootMotionSource [ID:2]FRootMotionSource_MoveToForce None from 0.009488 to 0.005232
LogRootMotion: VeryVerbose: RootMotionSource being removed: [ID:2]FRootMotionSource_MoveToForce None```
#

I increased the duration, and it is increasing the delta time of logging the add and remove so essentially it's ticking the root motion source but not applying correctly the translation. Is there something specific to be set for the StartLocation / TargetLocation parameters? Or other params?

azure grove
#

What's the best resource for learning multiplayer via examples and different projects? (besides exi's compenium)

#

I watched a tutorial series from unreal only to find out it had some incorrect stuff in there..

twin juniper
#

hey I wish to move a object for a multiplayer
[9:55 PM]
and it is not replicating
[9:55 PM]
please helpppppp

lime wren
#

movement replicates ?

azure grove
#

what k3 means is just tick off movement replicates

#

on the properties for that actor

#

also tick off replicates

idle flame
#

Hello,
Is it possible to create an Object or Actor that will be replicated only to a specific player and different for each player.
Server : A1(ForPlayer1) A2(ForPlayer2)
Player1 : A1
Player 2:A2
I want to know if I can create an actor own by the server,unique for each player and replicated to one player ?

rich ridge
#

@idle flame yes you can do that..
Let your server spawn actor A1 only on Player1... And so on...

twin juniper
#

@lime wren I have done

idle flame
#

@rich ridge Do you have any links pls, I don't know how my server can spawn an actor on a client.

rich ridge
#

@idle flame I will give you a hint...
PlayerController is created by server and and it's mapping is like

Player1 -> PlayerController 1
Player2 -> PlayerController 2
And so on..

lime wren
#

Niceee

rich ridge
#

If you want to see how it's implemented..
Please check Login and InitPlayer function inside GameMode..

#

@idle flame

#

You can assume the PlayerController1 as your spawned actors.

peak star
#

@twin juniper is the movement deterministic or nondeterministic?

rich ridge
#

@idle flame I would suggest you have a look at replication graph, it offers better design and quite flexible if your requirements change.

twin juniper
#

@peak star no idea

peak star
#

I mean does it always move in a planned expected way or can it be moved in a way that isnt planmed or expected?

#

If it is moving in a planned out way that can't change then you can just control it with a replicated timeline

idle flame
#

@rich ridge thx,
Dunno If I am right but in the Login function, they spawn the playerController and they give it an Investigator.
I should give my player controller as investigator ?

#

In the function AGameModeBase::SpawnPlayerControllerCommon

rich ridge
#

use same code and make a generic function in gamemode which spawns Actor instead of PlayerController

lime wren
#

Guys how can i restart the map please ? Because actually, when i restart it, the server ok but the client is disconnected

#

how can i fix that please ?

rich ridge
#

As per my understanding the restating of map is equivalent of loading a map. @lime wren

#

So this behavior is expected

lime wren
#

but i want everybody reload the map

#

and no disconnect

lost inlet
#

you might want to show everyone how you're currently travelling. you should be using GetWorld()->ServerTravel(...)

lime wren
#

im with blueprint

#

just servertravel ?

lost inlet
#

well what are you doing first of all

#

just executing a console command?

lime wren
#

i just want to restart the map for everybody

#

and keep the session (connection)

lost inlet
#

yes and i want to know what you're doing that causes clients to disconnect

lime wren
lost inlet
#

uh

#

you shouldn't execute this command on clients

#

no wonder

lime wren
#

just on the server?

lost inlet
#

yes

#

GetWorld()->ServerTravel(...) ie. what that concommand executes, is responsible for telling clients to travel

lime wren
#

this doesnt work

#

the clients disconnect

lost inlet
#

are you testing in the editor?

lime wren
#

yes

lost inlet
#

ah no wonder

lime wren
#

i need standalone?

#

And maybe

#

the problem is this

#

?

#

when i create the server

lost inlet
#

i'm not sure why you need to execute a node when to travel in the editor when you could just set that map as the default map on dedicated

lime wren
#

ok

#

it work in standalone

limber gyro
#

replicated c++ variable when called in BP has value of 0

#

could this be because BP executes before c++?

lost inlet
#

well where is it executing

#

because there can be a delay in getting replicated values

limber gyro
#

begin play

#

so that could be an issue i guess

lost inlet
#

that's something you can use an onrep for. since it's in C++ you could set up a delegate for when the value updates

lucid vault
#

Is there a function that get's called on the client when a character is possesed?

#

I want to hide the character's head if locally controlled

#

Begin Play doesn't work because IsLocallyControlled() returns false. There must be a delay before the player possesses it

limber gyro
#

im pretty sure there is i just dont remeber the name

#

onPosses maybe

lucid vault
#

There is PossessedBy, but it's on called on server

#

Restart will work

twilit oak
#

im trying to add SteamSDK to unreal, and in the guide they say: Open "OnlineSubsystemSteamPrivatePCH.h" (located in "..\..\Plugins\Online\OnlineSubsystemSteam\Source\Private\"), where you'll find the following line of code, defining the root location of the Steamworks SDK: problem is, "OnlineSubsystemSteamPrivatePCH.h" does not exist, closest i can find is "OnlineSubsystemSteamPrivate.h" does anyone know if its been moved somewhere else? what do i do?