#multiplayer

1 messages ยท Page 431 of 1

hardy ferry
#

@winged badger Thanks!

#

Is there also any significant benefit to using C++ in a networked game instead of blueprints, even if you're nativizing?
4 players, less than 30 ai

winged badger
#

I find BP networking very messy

#

Like if you change repnotify variable in BP, it will call onrep on itself

hardy ferry
#

Ah, so a little extra overhead?

winged badger
#

Also, its rarely readable

#

No it behaves differently

hardy ferry
#

Okay

winged badger
#

C++ onrep wont be called on server, BP will

hardy ferry
#

Okay, that makes more sense, I encountered that before and got confused by it

#

Glad this chat is here. Not surr if my google-fu is weak, but it seems like theres a lot of questions that arent answered there.

winged badger
#

And for more complex scenarios, BPs just dont support those

#

Starting with unable to override isnetrelevantfor

#

To being stuck with default serialization

#

Also c++ networking takes far less space

hardy ferry
#

Yeah, thats what I was curious about, if you have to send less data over for the same operations

winged badger
#

With BP, replicated array, you have to replicate the entire thing

#

Anr only client side callback you get is that array has changed

#

In c++ you can send only the delta, and get callbacks per itel for add/re ove/change

#

And it doesnt even take alot of work to implement

hardy ferry
#

I will definitely have a look at that.

winged badger
#

Read the NetSerialization.h header, it has comments and even an example for that

hardy ferry
#

Just trying to learn this stuff. Im trained as a designer, but Im kinda making a networked fps solo, and running into performance issuds, so turning to C++ here

#

Ooh, okay

#

Taking notes btw

winged badger
#

Also, making all RPCs reliable doesnt imptove networking

#

ServerMoveTo functions in CMC are all unreliable

hardy ferry
#

Not 100% sure what you're saying there. Server replicating position of actors?

winged badger
#

People tend to mark every RPC reliable when starting with networking

#

That actually makes things worse

hardy ferry
#

Unreliable means it can get dropped entirely, yes? I do reliable for all necessary operations, like firing your gun and reloading, but not for particle effects and sound

winged badger
#

Thats ok

#

Gtg

hardy ferry
#

Thanks for the info!

#

Good luck

sharp pagoda
#

Yes Kyle unreliable RPCs can be dropped, while reliable RPCs are guaranteed (unless a net error occurs) to arrive.

hardy ferry
#

Yeah, thought so

pallid mesa
#

however, don't do reliable stuff on tick.

#

leave reliability for event based stuff

sharp pagoda
#

@pallid token What do you mean it doesn't show up on clients? Is the rpc firing off?

#

Err sorry misread the second half.

pallid token
#

Yes, it's firing, because within the same RPC, It spawns a projectile (It's a cannon) that appears on all clients.

sharp pagoda
#

Can you show what you're doing?

pallid token
#
void AInteractiveCannon::FireCannon_Implementation()
{
    if (CannonballClass != NULL)
    {
        UWorld* const World = GetWorld();
        if (World != NULL)
        {
            const FRotator SpawnRotation = ProjectileSpawn->GetComponentRotation(); 
            // MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position
            const FVector SpawnLocation = ProjectileSpawn->GetComponentLocation(); 

            //Set Spawn Collision Handling Override
            FActorSpawnParameters ActorSpawnParams;
            ActorSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;

            // spawn the projectile at the muzzle
            World->SpawnActor<ACannonballProjectile>(CannonballClass, SpawnLocation, SpawnRotation, ActorSpawnParams);
        }
    }
    if(CannonFlash)
    {
        FVector ParticleLocation = ProjectileSpawn->GetComponentLocation(); 
        FRotator ParticleRotation = ProjectileSpawn->GetComponentRotation(); 
        UGameplayStatics::SpawnEmitterAtLocation(this, CannonFlash, ParticleLocation, ParticleRotation); 
    }
#

The last if block is the effect.

sharp pagoda
#

Can you prove that CannonFlash is valid?

pallid token
#

It appears on the client that uses the cannon, but not any others.

sharp pagoda
#

Is the "client" that fires this an actual client or a listen server?

pallid token
#

In my tweaking, I set it to a listen server and forgot, which creates a whole slew of other problems. Now, set with a dedicated sever, none of that works on any clients...

sharp pagoda
#

Alright, show your chain of events starting with the button press to what we're looking at now

pallid token
#

Ok, let me put it all together in a legible format.

pallid mesa
#

GeoD I think your problem is lack of knowledge in networking in general for what you are saying, as a recommendation you can check out cedri exi multiplayer compendium which is anchored on this channel up there

#

You will then understand context, simulated proxies, authority and ownership

#

it is really handy when you are starting out

#

Also you will understand why something works on a listen server and not on a dedicated server

pallid token
#

Ok, I got the projectile to spawn pretty easily. I calling the Implementation rather than the function defined in the .h. Dumb mistake made on too little sleep. The particle effect still does not spawn.

#

@pallid mesa, I refer back to that very often.

sharp pagoda
#

Just ping me when you have the callstack

pallid mesa
#

as a sane practice, when you deal with weapons it is good to have a burstcounter that you update every time you fire, similar to what ShooterGame does. Since the onrep execs on every client you can take profit of that and spawn your weapon muzzles there

#

the server would handle its own effect separately so think on the onrep as a thing exclusively for clients, since on C++ the onrep doesn't get called on the server ~

#

if you have ShooterGame by hand check out SimulateWeaponFire() and OnRep_BurstCounter()

#

ShooterGame had a couple context bugs 2 versions ago but now I would say it's pretty solid networking wise

pallid token
#

I will absolutely check that out. I'm about to download ShooterGame, now. Thank you.

pallid mesa
pallid token
#

void AGoldenAgeCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent)
{
    check(PlayerInputComponent);
    PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &AGoldenAgeCharacter::Use);    
}
void AGoldenAgeCharacter::Use_Implementation()
{
    AInteractiveActor* usable = GetUsableInView();
    if (usable)
    {
        usable->OnUsed(this);
        bHasNewFocus = false;
    }
}

//InteractiveActor.h  I am using this as an interface of sorts. I found the Interface functionality to be a bit awkward and clunky for this. 
UFUNCTION(Server, Reliable, WithValidation)
virtual void OnUsed(AGoldenAgeCharacter* FPSChar); //defined in InteractiveActor.cpp, but it's not worth adding to this.

//InteractiveCannon.h
protected:
    UFUNCTION(NetMulticast, Reliable, WithValidation)
    void FireCannon();
    UFUNCTION(NetMulticast, Reliable, WithValidation)
    void SetFuseTimer();

public:
    virtual void OnUsed_Implementation(AGoldenAgeCharacter* FPSChar) override;

//InteractiveCannon.cpp child of InteractiveActor
void AInteractiveCannon::OnUsed_Implementation(AGoldenAgeCharacter* FPSChar)
{
    SetFuseTimer(); 
}
void AInteractiveCannon::SetFuseTimer_Implementation()
{
    GetWorldTimerManager().ClearTimer(FuseToExplosionTimer);
    GetWorldTimerManager().SetTimer(FuseToExplosionTimer, this, &AInteractiveCannon::FireCannon, 0.5f, false);
}
void AInteractiveCannon::FireCannon_Implementation()
{
    // ...Code that fires projectile posted above. This code works, and the projectile spawns on all clients. 
    if(CannonFlash)
    {
        FVector ParticleLocation = ProjectileSpawn->GetComponentLocation(); 
        FRotator ParticleRotation = ProjectileSpawn->GetComponentRotation(); 
        UGameplayStatics::SpawnEmitterAtLocation(this, CannonFlash, ParticleLocation, ParticleRotation); 
    }
    
}
#

@sharp pagoda, my convoluded Callstack. Thanks for your help, so far, by the way.

sharp pagoda
#

Alright so I'll just make comments as I go

#

Use() is a server rpc, right?

pallid token
#

Yes.

sharp pagoda
#

So you're stringing together multicast rpcs, which is going to cause problems

pallid token
#

Oh, ok. If the first one in the String is Multicast, will it call them all multicast, or should I find a way to stuff it all in one?

sharp pagoda
#

So Use() should be a local call (not an rpc), and then (if you are a client (IsLocallyControlled + !Authority) call a ServerUse() rpc to relay back and then call Use() in the context of the server. Or you could make Use() completely local so you don't suffer overhead from clients spamming their use button, and just let the client run the OnUsed() rpc

#

Issue with #2 is you have to trust the client to not cheat it to run OnUsed() on an item halfway across the map, but there are other things you can do for that

#

OnUsed() probably shouldn't be a server rpc because you probably want immediate feedback for the client

#

For example: If you press "use" on a cannon, you don't want to wait a couple milliseconds to see it do something, you want to have that thing fire as soon as you click it

pallid token
#

Ok, I understand, but does that,then call a ServerOnUse() to do the server stuff?

sharp pagoda
#

Yea so the big issue in your code is stringing together multicast RPCs. Recall that a multicast RPC runs for every client (if called from the server), so what happens is every client receives the FuseTimer rpc, then every client launches yet another multicast rpc for the actually firing

#

Can you quote which block of text you're referring to?

pallid token
#

You mean the original problem I'm having?

#

With the particle effect?

sharp pagoda
#

Yea it looks like the game breaker is the multicasts, but what block of text are you referring to with "then call a ServerOnUse() to do the server stuff?"

pallid token
#

You said that OnUsed() should not be a Server RPC so that the player get's the instant reaction. That's the link between the player and the server, so calling that as a local function would cause the server to not get it, right?

sharp pagoda
#

Ah ok, so what I mean there is something like this:

// Called directly from the player input bind
void OnUsed()
{
    if (Role < ROLE_Authority)
    {
        ServerOnUsed();  // this is just a server rpc that does { OnUsed(); }
    }

    auto item = FindSomeItemInMyView();
    item->OnUsed(this);
}
pallid token
#

That's what I was thinking. Thank you!

sharp pagoda
#

That way OnUsed() gets called locally and on the server

winter plover
#

So small question time. I am considering redoing my inventory system from being a standalone actor to a component. Are there any things I should be looking out for replication wise? Is it gonna be as simple as switching the parent class from AActor to UComponent?

#

In the past I tried implementing it with UObject (when I had next to no experience with ue4) before switching to AActor, which caused some issues, but I'm guessing that components already have some replication built in, right?

sharp pagoda
winter plover
#

ahh sweet

#

theres nothing I have to do different right?

#

the same macros and whatnot for marking stuff for replication apply?

sharp pagoda
#

"These components may replicate properties and RPCs in the same way an Actor can. Components must implement a ::GetLifetimeReplicatedProps (...) function in the same way Actors do."

#

Yep

#

The doc explains it all

winter plover
#

aight sweet, might go alot faster than I feared then

pallid token
#

So, I have implemented your suggestions, and it still fires the projectile, but it doesn't play the Particle System on the clients.

jade gazelle
#

I am using actor components for a lot of my systems, including inventory, and have noticed that even though the component itself replicates automatically, the variables I set it in it do not unless I check the additional box โ€œcomponent replicatesโ€

#

Just FYI @winter plover

winter plover
#

yea I set that in my inventory constructor

#

so it should be automatically set

fleet bear
#

It was here a few days ago talking about cross platform networking. I totally forgot about this article

#

So does that mean this is easier if you use Xbox live natively?

#

Because at minimum you get cross-play between PC and Xbox already

jolly siren
#

Is there a size difference between replicating a TSubclassOf vs. a pointer to the DefaultObject ?

#

via rpc

jolly siren
#

Answer: profiled and it's the same

winged badger
#

@jolly siren its the NetGUID either way

jolly siren
#

Thanks Zlo ๐Ÿ˜ƒ

rare cloud
#

someone know the minimal requirement for a dedicated server to prototype for only 5-10 players ?

#

without hard tasks

#

actually we got an Intel Atom N2800 (2 cores 1,86GHz) with 4Go DDR3 1066 MHz for some web stuff

#

I don't know if it's enough to run a really simple unreal dedicated server

jolly siren
#

That should work fine for prototyping

rare cloud
#

ok thanks ๐Ÿ˜„

humble lark
#

Would PixelStreaming go under multiplayer?

#

working great on LAN. Very interesting tech. My problems start when configuring SignallingWebServer to hook up to my TURN server.

#

its the peerConnectionOptions param in config.json that isn't being parsed right in cirrus..? i believe

#

i would explain more of my situation, but im not sure this is the place.

humble lark
#

config.json looks like this

#
{
    "UseFrontend": false,
    "UseMatchmaker": false,
    "UseHTTPS": false,
    "UseAuthentication": false,
    "LogToFile": true,
    "HomepageFile": "player.htm",
    "AdditionalRoutes": {},
    "httpPort": 81,
    "peerConnectionOptions": "{ 'iceServers': [{'urls': ['turn:TURNserverIP:3478']}] }}"
}
#

Running SignallingWebServer run.bat gives an "unexpected token ' in JSON, which after googling seems to actually be a js.parse error maybe? im v bad at javascript.

#
npm WARN cirrus-webserver@0.0.1 No repository field.
npm WARN cirrus-webserver@0.0.1 No license field.

audited 391 packages in 2.605s
found 1 low severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
16:32:25.225 Config: {
        "UseFrontend": false,
        "UseMatchmaker": false,
        "UseHTTPS": false,
        "UseAuthentication": false,
        "LogToFile": true,
        "HomepageFile": "player.htm",
        "AdditionalRoutes": {},
        "httpPort": 81,
        "peerConnectionOptions": "{ 'iceServers': [{'urls': ['turn:XXXXXXXX:3478']}] }}"
}
SyntaxError: Unexpected token ' in JSON at position 2
    at JSON.parse (<anonymous>)
    at Object.<anonymous> (D:\DEV\Proj\packaging\wintyGermsPixelStream\PixelStreaming\WebServers\SignallingWebServer\cirrus.js:121:45)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Press any key to continue . . .
#

Tried a bunch of different formattings of the "peerConnectionOptions" value, which is supposed to be a string even if its json(as specified in pixelsstreaming Reference)

#

im running out of ideas

#
clientConfig.peerConnectionOptions = JSON.parse(config.peerConnectionOptions);
#

thats line 121 in cirrus.js

#

but i assume the problem is the peerConnectionOptions-value in config.json

hasty adder
#

So I found a old โ€œtutorialโ€ regarding beacons

#

Curious if someone can skim the code to let me know if anything looks massively out of date and not worth trying to follow ๐Ÿ˜ƒ

safe flame
#

Hey does anyone have some spare time to help me with setting up a dedicated server? I did it alone and there are no errors or warnings but I cant connect to it.

digital violet
#

Any tips on how to make a clients attack go from Client 1 to Server to other Clients?

#

like, how to I tell the server only to send an event to all clients but the one who initiated the original event

#

It's a first person shooter and I can't have the player have to wait for the server just to get the feed back of their attack input =d

#

Or am I doing this the wrong way? <.<

#

Or should I send the Input with like an ID and so the Original user can identify it and ignore the event? o.O

unique wave
#

@digital violet Haha, it's fun to see basically one of my own first questions when working with ue4 pop up :p

#

UE4 does not provide a multicast that goes to everyone "except owner". They don't want to add one either.

digital violet
#

lol, hope you found a good solution ^^

unique wave
#

They expect you to keep your own list of clients to send it to, and then send it by Client RPCs to them.

#

What we did, because we were nubs, was just make the original client ignore the multicast for the attack event that they had already client-side predicted would work.

#

Today I would maybe invest a bit more time into making it send the RPC only to the affected clients. But doing it with a multicast isn't that bad.

digital violet
#

Do you know a good resouce or maybe a good vid turotial showing how to do it? =d

#

Maybe i can find out how by watching enough RPC vids <.<

unique wave
#

Well you'd do something like this:

  • ClientA does an attack.
  • ClientA calls "ServerDoAttack", and then immediately "DoActualAttack"
  • Server gets the "ServerDoAttack" and calls "MulticastDoAttack"
  • Server gets "MulticastDoAttack" -> Calls "DoActualAttack"
  • ClientB, ClientC, etc. etc. gets "MulticastDoAttack" -> Calls "DoActualAttack"
  • ClientA also gets "MulticastDoAttack" -> you confirm that this is running on your locally controlled client (There's a IsLocallyControlled function) and therefore do not call "DoActualAttack", since you already called it when you started the attack.
#

This should work for all clients, in any ListenServer/DedicatedServer setup.

#

It will only fail for NPCs if you try to make them use the same callpath.

#

(which you shouldn't)

digital violet
#

Hmmm, k ๐Ÿค”

#

I'll ready up a bit on IsLocallyControlled ๐Ÿ˜ƒ

unique wave
#

And you can join me in my silent plea for wanting an RPC type that goes to everyone except owner. :d

digital violet
#

it would be very very useful ^^*

#

super thanks ๐Ÿ˜„

unique wave
#

It makes sense for clientside predicted actions like these, but it is technically solveable without it, so I guess they don't want to bloat the RPC types. Which is fair enough.

digital violet
#

Would I use the same thing on a projectile actor?

#

Right now when using a flamethrower the original client gets two projectiles x)

#

I would like the original player to se the projectile as soon as he/she attacks, but also for the server to say to all players where the projectile ends up

unique wave
#

That one is harder to answer. Our game has slow enough projectiles, but still fast enough exit (arrows), that we just spawn them on the server and let them replicate from there. Without spawning a client version.

digital violet
#

Fair enough =d

unique wave
#

So never looked into syncing a client-side predicted arrow with a server spawned one ๐Ÿ˜ƒ You need the server one for authority

digital violet
#

Also: So the server sending a Multicast event also sends it to itself? ๐Ÿ˜ฎ

unique wave
#

yes

digital violet
#

Hu, ok nice ๐Ÿ˜ƒ

rare cloud
#

how can I send the Portal variable from GameModeBase::Login ?

thin stratus
#

@rare cloud As far as I can see it's passed via the URL

rare cloud
#

it's used to choose the PlayerStartActor, and actually I don't know the format to use Portal :/

#

"?Portal=" maybe

#

seem strange

thin stratus
#

Well it is an FString

#

Here is where it's set

#

@rare cloud

rare cloud
#

thanks !

#

so if I understand correctly I need to put # instead of ?

thin stratus
#

Not sure

rare cloud
#

@thin stratus I can confirm ๐Ÿ˜„

#

127.0.0.1?Name=Jackblue#Portal is a valid URL

#

and the portal string is used inside the FindPlayerStart to determine which PlayerStart have a matching tag with the portal string

#

if this can help someone

potent prairie
#

when I enable Steam Advanced Sessions, I can no longer join my dedicated server with a direct IP. But if I disable the plugin and just use regular Advanced Sessions, I can connect with the IP again. Is there a special command to connect when the steam plugin is enabled?

potent prairie
#

???

low pond
#

How do people normally go about resolving "client connecting with invalid version" ?

fleet sluice
#

@low pond They build the game and the server without making changes between builds.

slim holly
#

steam doesn't use direct IP addresses

#

they are all masked

twin vault
#

is voice chat enabled by default over steam?

loud umbra
warm summit
#

Hi, I have a problem. I made a multiplayer game supposively should run on either lan or internet. I'm first working on lan. Here my problem: Everything is fine when I try it in the PIE with multiple clients. But when I package the game and open it up on 2 different pc (both different steam account) and connect both to the same network, it doesn't connect. I can create a session, but not join one. Maybe I have a windows firewall problem or my network is set up wrong or something.. Any ideas?

winged badger
#

the LAN checkbox doesn't really work well iirc

#

should be fine as long as its unticked

thin stratus
#

Hm not sure

#

I never had an issue with the LAN tick box

jolly siren
#

Does anyone know of an alternative to open 127.0.0.1 for testing disconnection / reconnection in PIE? It used to work, but it doesn't anymore. I logged a bug when they broke it but they never added it to issues :/

#

ah figured it out ๐Ÿ˜ƒ

#

There are disconnect and reconnect console commands

thin stratus
#

Just read it

#

xD could have told you

jolly siren
#

Never knew about those

#

For whatever reason some console commands don't show the autocomplete

#

man those make it so much easier to test โค

cedar finch
#

So I'm wanting to clean up some of my blueprints where I have delay nodes. I have them because I need small delays before updating or displaying HUD info and playername info. But they don't allways work in a networked multiplayer game where stuff could go wrong. So how can I use RepNotifies to fix these and not have delay nodes? Here is one instance where I use a delay when I respawn and Possess my new player character and update his HUD with his new health etc. https://i.gyazo.com/db8006ffd0459294bd3ba60175c58428.png

#

I thought I could just make a new RepNotify variable and then place my logic above inside the RepNotify function but I can't figure out how to get that "New Controller" inside the RepNotify

late sundial
#

hey, im looking for a new network solution. currently im using steam advanced sessions plugin but because epic store will also be there im looking forward to it if i manage to find something nice. you can also suggest marketplace plugins if there is something what does the same.

cedar finch
#

I guess what I'm basically asking is, "For Multiplayer Games, what do I use instead of delay nodes?"

sharp pagoda
#

@cedar finch I swear I talked to you about this a few weeks ago, you want to use rep notifies and RPCs. For example, if you want to run some code as soon as the controller is available (after a respawn event, for example), you would run your code in the rep notify for the controller.

cedar finch
#

@sharp pagoda Hey man! Yea I got caught up with family and Thanksgiving I just got back to working on this. So I'm a little confused and maybe you can clear this up. Do you not keep your controller the whole time? For some reason I thought you just destroy the controlled pawn then possess a new one and keep the same controller. That's why I'm confused on the possession because I thought it would be inside the pawn. Do i have it all wrong?

sharp pagoda
#

"Do you not keep your controller the whole time" It depends on your perspective. If you're from the perspective of the local player, yes you always have a controller. If you look from the perspective of a newly spawned pawn that you're in the process of possessing (in the event of a respawn), no.

#

In the example of a respawn, you can't assume there's going to be a controller at some point like begin play, even though you are sure that the server called Possess as soon as you spawned the thing.

#

Instead, you want to use OnRep_Controller() (as a client) so you know exactly when the possession event is completed, where you now have a valid controller.

#

As for the server, you use OnPossessed() to do the same thing.

#

In your case you're using blueprints, where an abstraction is provided called Event Possessed

cedar finch
#

Ok so the OnPossessed() is the same as the blueprint "Event Possessed" ?

sharp pagoda
#

No, it's half of it

cedar finch
#

I can't find the OnRep_Controller to override

sharp pagoda
#

OnPossessed == Server
OnRep_Controller == Client

#

EventPossessed == Server + Client

#

Yea the first two are hidden from you in blueprint

cedar finch
#

So if EventPossessed has both why not use it?

sharp pagoda
#

Well you have to, in blueprint. In C++ you might want finer tuned control

cedar finch
#

True, but I havn't got that far yet lol

sharp pagoda
#

Err sorry it's not OnPossessed, it's PossessedBy() in cpp.

cedar finch
#

So I understand how you can run the RepNotify logic but I feel I'm using it wrong. For example In my player controller I run a 'Server' event that sets the players name inside my playerstate. Then inside my PlayernameWidget I retrieve that playerstate name and set it as my name. I got it working but It runs in a loop for clients until it gets their name. I feel like this is probably not how I should do it. https://i.gyazo.com/c0a2094a1b9d71f5af712768e57cc3d0.png https://i.gyazo.com/02b660e2e7bbd4b9309847f015d6ad95.png https://i.gyazo.com/69f4f82bf36540a78365d08b52423f42.png

#

I used to have a 2 second delay after the "Event Construct" node in order to give the playerstate time to set the names of the players. Without the delay my player names wouldn't show up.

sharp pagoda
#

@cedar finch You had the right idea with the OnRep there. All you have to do is GetMyHUD()->UpdateUsername() from there.

#

Remember that OnRep will execute for all relevant clients (and in the case of BP, the server too).

#

(It will also execute for non-relevant listeners that become relevant later)

cedar finch
#

I haven't even used the actual HUD yet I just have widgets that I created for my health and stuff. Is that what you're talking about?

sharp pagoda
#

Yes, also 99% of the time have your HUD act as an abstraction and management layer for all of your widgets.

#

You nearly never want to interface directly with widgets in game code

#

That introduces heavy UI coupling

#

(The 1% case is for things like weapons that have their own custom widgets, where you will have the weapon class manage the widget instead of the hud)

cedar finch
#

So I'm trying to wrap my head around this, where do I call GetMyHUD() and what is the UpdateUsername() do? I mean I can guess it updates the username lol but my name is stored in a custom variable in playerstate

sharp pagoda
#

Those were just placeholder names.

cedar finch
#

Ah gotcha.

sharp pagoda
#

The concept is to get your hud, then run a function in your hud that tells your specific username widget to update

cedar finch
#

Oh so take out the Construct event and just use a custom event that gets called from the Rep inside Playerstate right? Thats what your saying?

sharp pagoda
#

Yep, you don't want to try and fetch the username on construct, just null out the text.

cedar finch
#

yea thats what was happening

sharp pagoda
#

Fill the text once your receive the username over the network (aka onrep)

cedar finch
#

Ok now I understand. ๐Ÿ˜ƒ Thanks for explaining and helping.

sharp pagoda
#

yw

cedar finch
#

I'm sure I'll get stuck again but I'm going to see if I can fix up some more of these little issues with delays. I just wish the internet and YouTube didn't have so many bad tutorials and instructions

sharp pagoda
#

You really shouldn't have any delays to deal with networking, those are super hacky solutions, if they're even considered solutions. You can do everything with net callbacks and rpcs.

cedar finch
#

Gotcha. I got one last question that you mentioned earlier. Getting your HUD from your playerstate. How exactly do you do that? Cast to HUD? I've never done it but It will be extremely useful

pallid mesa
#

some call these delays "manual buffers" which is hilarious.

hasty adder
#

Donโ€™t delay

pallid mesa
#

it isn't even a buffer anyways

sharp pagoda
#

No you can't cast your player state into a hud, because those are two totally different and unrelated objects. You want to get the owner of the player state, which is the player controller, then from that player controller call MyHud() (something like that, would have to open docs for exact spelling), then cast that HUD pointer to your specific HUD class.

#

@cedar finch

hasty adder
#

On poses bp you can ca

#

L

hasty adder
#

Er call a run on client incoming controller event to run on server to set name

sharp pagoda
#

Inphidel you missed the entire convo on that haha

hasty adder
#

Oh lol

#

Gg

sharp pagoda
#

Pretty sure he knows what to do networking wise now

pallid mesa
#

it's a bit concerning that some basic concepts such as type casting are not ackwnoledged yet and still tries to do networking, I would worry first to settle knowledge base of 101's in unreal and then dive to the pool of the multiplayer with the wonderful materials we have anchored @ this channel

sharp pagoda
#

Also don't forget to check if your pointers are valid before dereferencing them in this case. If you're on a dedi server and try this, you'll crash since there is no player controller @cedar finch

hasty adder
#

Iโ€™ve experienced first hand the fun and still do retrofitting hacks with better solutions

#

Kinda why I lurk here \o/

pallid mesa
#

Asuming he is on BP's it won't crash but a red will appear, so add the IsValid macro to the code on the blue wire

sharp pagoda
#

I think he knows some oop vorixo, since he's using polymorphism in other places and hasn't had a problem so far

pallid mesa
#

I don't know the question about casting hud to PS was a bit scary, still we are here to help ^-^

sharp pagoda
#

It's usually pretty obvious when people don't know how to use type casting

#

Yea haha, I think the response wasn't thought out

pallid mesa
#

It's something common, and that's a concern I've been having all this time, which will prob lead me to write some 101's for Unreal "what to do before starting with the engine"

#

I find wonderful the amount of people that grabs the engine to create, however some of them usually take the "youtube tutorials" way (there are some that are wonderful like Wadstein ones or Epic official ones, let's not put them all in the same bucket).

hasty adder
#

Make pong

pallid mesa
#

Anyways too off topic!

cedar finch
#

Thanks guys. Sorry I had an emergency come up and had to leave quick. I'm back now. I didn't mean it how It sounded with the casting to HUD lol. I see exactly what you guys assumed I meant. No i'm not that much of a noob. I meant what @sharp pagoda said earlier about casting to your HUD when you get it. I was fishing for that GetHud node.

pallid mesa
#

oh okay, glad to hear, hope you understand my concern

cedar finch
#

Yea I do. I usually put thought into my questions before I type them but I was super rushed and had go get my car out of the shop and only had 10min to get there before they closed. lol

pallid mesa
#

while it's good to think what you write, that isn't the core of the problem xD

cedar finch
#

I know. The problem is trying to run before you can crawl.

cedar finch
sharp pagoda
#

@cedar finch So a widget component is another one of the 1% cases. The widget is specific to the character and can change with different characters, so the individual character manages the widget. The HUD isn't involved here

cedar finch
#

So there isn't a way to communicate between the PlayerNameWidget and the Playerstate? I was going to remove my Construct event and put in a custom event and then try to call that custom event from the playerstate, but i can't reference that custom event because it's inside the widget

#

playerstate-->playernamewidget which sets the name

#

The text inside the widget just needs to be set to the name that's inside playerstate.

#

Event dispatcher?

sharp pagoda
#

Playerstate -> Controller -> Character -> Widget Component -> Widget

cedar finch
#

I'm not sure how to use it. I can only get or set it

sharp pagoda
#

You're just missing the last step, which is getting the actual widget from the container (widget component)

#

And also added safety checks or you'll get errors thrown in dedi servers

sharp pagoda
#

There you go

cedar finch
#

๐Ÿ˜ƒ

cedar finch
#

@sharp pagoda It may be because I'm testing inside the engine but sometimes the Clients names are not set and just appear as the Default text. ๐Ÿ˜ฆ Server always see's everyones names but Clients just see "Default" Clients fail this first isValid https://i.gyazo.com/ede50adb8c65bbf62dc8f12ab953b277.png

sharp pagoda
#

Right, because clients don't have access to other player's clients, so it will be invalid on any non-local player or the server.

#

So instead what you can do is not have this be a rep notify, and instead have the widget pull directly from the player state.

cedar finch
#

I'm confused because I thought that's what I had before the repNotify

#

I pulled the name from playerstate but had a 2 second delay so I make this repnotify

#

in order to get rid of the delay

sharp pagoda
#

Oh ok, so this is a floating text (or similar) that all players can see? I was under the impression that you wanted this for yourself only

cedar finch
#

It's a floating widget above players heads that I want others to see. I want to hide it from the owner so its not in their face.

#

Yes it contains text of their name

#

But sometimes it works and all names are correct.

#

Again it's like it comes down to a timing issue of, "are you setting the text of the widget before the actual name has been set?" type of dilema

#

This has been my major issue for everything widget related.

sharp pagoda
#

In your case you might want to have the rep notify on the player character, that way you don't have to interface through the player state.

#

Or have the player listen to an event signaled in the player state rep notify.

cedar finch
#

Ok so I have 3 widget related issues that I have to use delays for. first is the playernames which is what we've been talking about, second is the players health hud, third is the spectators hud. I want to create all three as soon as the games starts. But I have to have a delay on each in order for the character to get possessed first. I also have to update those widgets when respawning which again is OnPossessed. So do you have an idea on how to use the OnPossessed event or RepNotify to solve all 3 of these issues?

#

All three work most of the time but sometimes the clients don't load properly such as their player name not showing up correctly or their health not being shown correctly. It's always a timing issue

sharp pagoda
#

Is this player's health hud local or a floating bar above their head?

cedar finch
#

So the playername is the only one that is floating above the players head. The other two are created inside my playercontroller and added to the viewport

sharp pagoda
#

Ok, remember what I said earlier about decoupling through the HUD?

#

Move the spectator widgets and health widgets to the HUD, then when the character Event Possessed, MyHUD->DoSomeStuff

cedar finch
sharp pagoda
#

Absolutely. The player controller 99% of the time shouldn't even have to know what a widget is

#

It just talks to the HUD

cedar finch
#

hmmm So what if for example inside the OnPossessed event I call UpdateHUD which is inside Playercontroller. What difference does it make if that event is inside Playercontroller or HUD? Won't I still have the same issues?

sharp pagoda
#

Event Possessed -> is locally controlled? yes -> Hey HUD I now exist -> HUD sets up all the stuff.

#

You don't need to feed through the PC

#

You can interact with the HUD directly through the character

cedar finch
#

So as a PlayerController with no possessed actor HUD doesn't exist?

winged badger
#

it exists just fine

#

but without a possessed pawn you can't give the hud a possessed pawn as a context

cedar finch
#

So the Hud event can't run until you get possessed

#

gotcha

winged badger
#

and the pawn needs to be possessed to access the HUD "directly"

#

as that goes through the PC under the hood

sharp pagoda
#

HUD has no binding to the character, it is bound to the PC

#

The point of this Possessed callback is to notify your HUD that it can now start reading the health/etc values of a character

cedar finch
#

I understand now.

winged badger
#

altho Possessed might not be ideal, as it happens only on server, and there is no client HUD there ๐Ÿ˜„

#

SetPawn would be my preference, but its not BP exposed

sharp pagoda
#

The bp EventPossessed runs locally + on the server?

#

Cpp version runs server side only

cedar finch
#

I'm just trying to get the simple stuff working and understand how it works from the moment the game starts to the moment your an actual character. Sorry for all the questions lol. I just like knowing what is happening and how things are being setup.

winged badger
#

i can't find the client-side call to ReceivePossessed

sharp pagoda
#

Looked at the docs, the bp version does only run on auth/standalone, so you have to use the on rep for bp as well, but there isn't one exposed to bp that I can find

severe widget
#

I think AcknowledgePossession is the clientside func?

#

Haven't gone through to make sure its only client, but it seems to be.

sharp pagoda
#

Not seeing anything for that

winged badger
#

ideally, its SetPawn override, as its called from Possess and from OnRep_Pawn

sharp pagoda
#

Oh that's on the pc

severe widget
#

yea

sharp pagoda
#

Why would they not have OnRep_Controller exposed to bp ๐Ÿค”

severe widget
#

prolly cause nobody thought doing it yet

cedar finch
#

@sharp pagoda Well I'm guess I'm just out of luck. I moved my Hud stuff to my Hud blueprint instead of my player controller. Then create the huds once called inside the OnPossessed event. Only the host see's his and it only works if I add a delay before creating the hud. ๐Ÿ˜ฆ The same issue as before.

sharp pagoda
#

Yea, you're going to need to expose some cpp through a function library.

cedar finch
#

So I'll have to fire up the old Visual Studios again. Lol But I was wanting a Blueprint only game

#

I guess blueprint is not meant for multiplayer games yet is it?

sharp pagoda
#

Still blueprint, you're just exposing a helper function

cedar finch
#

I'm not sure what that means

sharp pagoda
#

You can write the code in blueprint, you just need to expose a little bit of missing functionality.

#

While you're at it you might as well remove the handicap that prevents destroying controllers in bp

cedar finch
#

I've never exposed stuff before so I'll have to figure that out somehow

#

I just get so frustrated at how difficult it is to do the most simple bare bones things for multiplayer. Playernames, Health and Hud stuff should be the core of 90% of most games right? Why is it so hard to get this basic stuff working in blueprints? I can make shooting, inventory, ai systems fine but heaven forbid I try to get playernames and HUD stuff in multiplayer. ๐Ÿ˜ฆ

sterile pebble
#

@cedar finch what's you problem?

#

you can store player names in player states or even game state, so every client will have properly replicated variable with it. For HUD it's better not to save anything important for replicatin inside HUD, but to use reference from player character code or some other place with proper replication (that's because HUD does not meant to be replicated)

umbral adder
solar halo
#

LogNet: PreLogin failure: incompatible_unique_net_id ideas?

#

Happens when I try to connect to a server.

umbral adder
#

ue4 version?

solar halo
#

4.21

umbral adder
#

if anyone solves my gamesparks issues ping me

solar halo
#

I'm using Steam.

#

I even run with -nosteam and same issue.

solar halo
#

So throwing UWorks on my project fixed it. lmao what

fleet sluice
#

Same here. That plugin seems to be a technological marvel.

solar halo
#

lol

fleet sluice
#

(Jokes aside, I had no idea it would solve that too; I just try to fix everything I can via plugins)

jolly siren
#

@solar halo Do you have steam auth enabled?

#

They added it in 4.20 and I'm wondering if it is required now (not talking about UWorks here)

solar halo
#

No clue lol.

#

How do I check?

jolly siren
#
[PacketHandlerComponents]
+Components=OnlineSubsystemSteam.SteamAuthComponentModuleInterface

In DefaultEngine.ini (or WindowsEngine.ini / LinuxEngine.ini / etc. if you have it broken out like shootergame)

solar halo
#

I can add that and try. Give me a few.

solar halo
#

@jolly siren Trying it now.

#

Have to wait for it to build.

solar halo
#
[2018.12.08-14.24.30:740][144]PacketHandlerLog: Warning: Unable to load HandlerComponent factory: OnlineSubsystemSteam.SteamAuthComponentModuleInterface```
#

@jolly siren

#

Am I supposed to do something else?

#

So it looks like I can join with 1 client. I'll revert to UWorks and see if that works.

solar halo
#

Works with UWorks

#

lol

jolly siren
#

Your dedicated server and clients are both using the steam subsystem?

#

ShooterGame has this setup and I don't see anything else there

digital violet
#

Hmm, so just realized I can't just have a client shoot with a weapon and tell the server to do the same. I need to make sure it's the same Spread ๐Ÿ˜“

#

But I can't have the client telling the server the vector of the shooting eather

#

Should I have the client generate a random seed used in the spread and send to the server? ๐Ÿค”

#

or would it be better to just let the server handle it all, having the players wait for feedback of their shot?

#

I'm making an FPS and of course I would prefer to have the feedback of the action to be as instant as possible

#

Maybe just have the client instantly see a muzzle flash and get the sound, and have that as sufficient instant feedback, then wait for the server to say there the shot landed

solar halo
#

Yes

#

@fleet sluice Does UWorks support SteamAuth?

fleet sluice
#

I don't know how Epic's SteamAuth works, but I have an example for authentication in UW-PlayerController.

#

I usually recommend people to implement authentication via the ISteamNetworking interface, after their server query is complete, but before actually connecting.

#

Saves a few disappointments in cases in which authentication is denied (off the top of my head, there are around 10 reasons or so why it would fail)

winter plover
#

@digital violet Seed is what you can use yea

#

make sure to have one set before the client decides to fire a shot

#

by the server

#

because otherwise the client could choose a seed that grants a low spread, and use that instead of randomly generating new ones

#

About sending the aim vector to the server, Im not sure if that is enough control for the client to do anything terribly malicious with it

#

if you only check the player aim on the server, chances are you might get the intent of the client wrong

#

purely because of delay

rotund wedge
#

@terse coral the 3rd one now mh

loud umbra
#

Hey guys I have a really important question: I rented a virtual Server but I dont know how to connect to it

solar halo
#

ssh or rdp

loud umbra
#

Sorry but I dont know what I have to do

solar halo
#

To avoid people getting info feel free to pm me.

west ridge
#

Anyone know if there's an option with UE4 to go past 4 local multiplayer with controllers? XInput clearly caps out at 4 in their API, but I didn't know if the SteamController API supports taking overflow (trying to figure that out now). The Windows.Gaming.Input API would be the way to implement it, but that's only used in the UWP fork, and, even then, it hard codes a limit of 4 in their implementation (though the API itself supports up to 8). So far from what I've found implementing a UE4 build that uses the Windows.Gaming.Input API seems to be the only way to get more.

halcyon abyss
#

Hey guys!

#

I have a huge problem!

#

๐Ÿ˜ฎ

#

Animations of clients on listen server are like at 10 fps

#

...tried this with a simple character that just inherits ACharacter

raven holly
#

is GetBaseAimRotation not replicated to the server?

#

its replicated but is weird

low pond
#

How do people fix issues with NetCL being different from the binary release when building from github source? I want to avoid everyone having to build their own client (or have a separate client release)

cedar finch
#

@sterile pebble I have my my hud and playernames working like you said but I can't make them always work due to not being able to use delays in multiplayer. For example when I get my playername from gamestate sometimes It hasn't been set or is in progress of being set. Same with my health HUD. I need a delay of one second before creating the hud in order to possess and get my players health values. If I display the health HUD at the verry beginning sometimes I don't get my health values so my health bar is blank. Weird stuff like that.

sterile pebble
#

@cedar finch yeah, in multiplayer you will often run into trouble with delays at the game start due to the replication delays. Most common case is to setup timers with small delay (1-2s); You can also use On_Rep (rep_notify) events, or do something more complex

sharp pagoda
#

@sterile pebble Using delays like that are absolutely not "most common case". You want to avoid that at all costs, always use net callbacks and/or RPCs.

pallid mesa
#

Never use non loopable timers for that. If you want to wait for something to happen and you dont want to do cyclical dispatching (ie PS and HUD at the game start, since there is not a waranteed loading order...). Do it with a proper "listener loop" where your timer would loop until the desired class is loaded (which is by the way not the best solution).

crude zenith
#

How would I go around making my single player RPG a multiplayer game?
I want to be able to select a character from the start if I don't already have one, then play with that character, and save to server. Upon logging in again, get the info from server and load in the character for that player.

All tutorials I've found so far only make it like a FPS, so you have to re-select each instance, etc etc, which is what I don't want.

spiral badge
#

Guys anyone can help me with a little problem with json?

bitter oriole
#

@crude zenith Multiplayer support is really something that will creep into every part of your game, so making a single player game multiplayer is a lot like re-creating it

#

I usually say MP is basically 5x more work

crude zenith
#

@bitter oriole I don't have an entire single player game set up yet, I've only been working on it for around 3 weeks now

#

I'm motivated enough to modify the several blueprints and other instances I have to update to multiplayer

loud umbra
low gate
meager spade
#

is it a montage?

low gate
#

?

meager spade
#

the animation?

#

for AnimBlueprint to play a animation, the variable it is using has to be replicated, and montaged have to be played on all clients, either multicast or by some other means (repnotify, for example)

random hazel
#

hey guys, i seem to have a problem with net cull distance enabling collision. I attach character to vehicle, disable actor collision, disable movement component. when goes out of net cull distance and then re-enters, it seems to auto-enable the character collision, causing the vehicle to fly off into space on the client side and offset the character outside of the vehicle body (but still attached)

#

this is 4.21

jagged garden
#

collision isn't replicated

#

so that could be part of it

#

and neither is physics

lime skiff
#

Any ideas, why an GE created with CreateDefaultSubobject<UGameplayEffect>("MyName") is not supported by FNetGUID? (e.g. doesn't have a NetGUID or is not name stable for networking despite being a default subobject)

LogNetPackageMap: Warning: FNetGUIDCache::SupportsObject: GameplayEffect /correct/path:CorrectUPropertyPointer NOT Supported.
random hazel
#

@jagged garden it's not replicated, but the client obviously does something when objects re-enter the radius, and it appears in this case it is forcefully enabling collision when it wasn't on exit of the radius

jagged garden
#

yeah thats strange

#

maybe try turning on 'bAlwaysRelevant'

random hazel
#

i'll test that later, but it's not a solution for an open world game

jagged garden
#

for something like vehicles where there aren't too many, it may be a viable option

#

although i dont know for sure

random hazel
#

ya, will take some testing , thanks for the input, would like to find the root cause, probably have to step into code and see what's going on

low pond
#

How do people fix issues with NetCL being different from the binary release when building from github source? I want to avoid everyone having to build their own client (or have a separate client release)

versed socket
#

@random hazel Nice assets man! Are they Marketplace or something? Or did you make them yourself?

random hazel
gleaming vector
#

when your characters enter a vehicle

#

are you doing an RPC to set up the "In Vehicle" collision state?

#

and things like attachment/pose/etc

#

because if so, that will not work when you leave and reenter the network bubble

#

since the RPCs will not be sent in that situation

#

@random hazel ^^

#

i ran face-first into this behavior implementing vehicles for squad

#

(yeah, watching your gif, that looks exactly like what I saw)

#

the solution I came upon is to use a replicated variable to represent whether or not a player is sitting in a vehicle

#

and then use an OnRep function to set up the no collision/pose/no movement stuff

#

(I called that SeatingState)

#

Replicated Variables are guaranteed to be there when an actor comes back into network distance

#

and OnRep functions are called in that situation

#

so you have full control over the state of your object on the client when it enters a netcull distance

random hazel
#

@gleaming vector thanks dude, you live up to your name! that's the info I was looking for, a way to hook when the netcull returns back in

gleaming vector
#

any time

#

good luck

#

I did all this like 2-ish years ago

#

there are still a good number of challenges

#

but that should get you mostly working

random hazel
#

much obliged

mighty schooner
#

When you want to stop an actor from being replicated and remove entirely from network what function should be called? Tear Off or Set Replicates to false or both?

grand kestrel
#

Just tear off

#

Keep in mind you can't undo that

#

Afaik

gleaming vector
#

you cannot undo tear off that is correct

#

but it is the solution

mighty schooner
#

Thank you Vaei and Roy :). I don't want to undo it anyways so I'll tear it off :).

night jay
#

HEllo, does anyone know if REplciation Graph had support for splitscreen games with 4.21

#

The doc of 4.20 regarding it says it can't yet but 4.21 put the feature out of early access so idk

red ledge
#

Try to take advantage of the quantization functionality that already exists. e.g. FVector_NetQuantize.

#

is there some resource to read on this? the only thing written in docs on FVector_NetQuantize is

0 decimal place of precision. Up to 20 bits per component. Valid range: 2^20 = +/- 1,048,576

Note: this is the historical UE format for vector net serialization
#

I'm trying to read a bit about optimizing the network code

#

also if someone has any "DONTs" that most people miss, that would be great

#

or general network optimization tips

night jay
#

I have a DONT that a lot of people do. Don't replicate hit results, only replicate what you need

#

Also, there is a lot of player information already replciated by default in your playerstate & gamestate, so make use of that

#

Also FVector_NetQuantize is simply a variable type like normal FVector

#

Replicating the NetQuantized vector sends over less bandwidth than normal FVector

meager spade
#

at less precision tho

#

which is perfectly fine for most use cases

night jay
#

Indeed

#

UE4 already works in cm so in a lot of cases 1 decimal is fine

red ledge
#

Need to read the source to know what hidden stuff are in the player state and game state I guess

#

but thanks a lot!

#

I think it has 0 decimal places

#

that is what doc says

pallid token
#

I have a server object that is noticeably jumpy when it moves. I'm just experimenting with it, right now, so when I scale it up in my project, it may not be as noticeable, but is there a way to increate refresh rate on it? Is that a dumb question?

night jay
#

In your actor you can set how often it updates

#

@red ledge there are multiple FVector_NetQuantize

red ledge
#

@night jay got it, thank you!

night jay
#

Np

winter plover
#

@pallid token Is it a physics object?

#

or a player pawn?

pallid token
#

Physics object.

winter plover
#

yea physics replication can be wonky at times, especially if you have lots of them at once

#

you geeeenerally wanna avoid it, because they basically trigger replications constantly

#

it's bad for bandwidth

#

if possible you want to keep any non-gameplay relevant physics not synced

pallid token
#

Is it not possible to just replicate the movement rather than the physics?

winter plover
#

that's what it does

#

but because it moves every tick, it updates every tick (that it moves)

#

and physics are rather complicated and can take a while to come to a stand still

#

what are you using physics for?

pallid token
#

To propel and steer a ship.

winter plover
#

dont use the actual physics for that

#

you will want to write a specialized movement component for that

#

which will be easier to replicate and predict

pallid token
#

that's what I actually want to do.

#

But I was finding nearly nothing on it.

winter plover
#

so I never really wrote my own yet either

#

so I cant really help much in that regard

pallid token
#

Meh, I'll figure it out.

winter plover
#

but you can peek into the source code of the ones that already exist

#

basically you will want to simplify the movement you want into just the necessary stuff

#

so I'd imagine bobbing up and down, and forward movement + steering

pallid token
#

And limited rolling from side to side.

winter plover
#

yea and that maybe

#

but the advantage of abstracting it into those few things, you can predict the movement alot better

#

it's not subject to random pileup of inaccuracies necessarily

pallid token
#

Ok, I see.

winter plover
#

if it makes it easier, you could just code the logic into the actor directly for now

#

instead of worrying how to write it as a component

#

you can always refactor that later if needed

pallid token
#

Yeah, that'd probably be easiest.

#

CharacterMovementComponent.cpp is only 10800 lines... This'll be fun!

cedar finch
#

So I've been looking into Event OnPossessed and it seems to only run on server. I found people who are in the same situation as me where they need clients to know exactly when they possessed a pawn in order to do some logic here: https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/91161-why-is-there-no-on-possessed-event-for-client I'm curious if anyone knows how to either override the restart function in APawn, or setup an OnRep boolean called IsPossessed in Blueprint only? I know it can be done in C++ but I want to keep it all Blueprint.

old hamlet
#

what does replicated in variables means ?

swift topaz
#

A replicated variable will make sure the value on a client corresponds to the value on the server, provided that replicated variable exists in a replicated actor.

old hamlet
#

thanks

old hamlet
#

so before unreal makes it's store it was to make and test an online game you would have to use the steam sup system , but right now i want to make my game available on the Epic Games Store , doesn't that mean I'll have to use some differenet method for that , having i mind that i have been searching Unreal Engine pages , but didn't find anything

winged badger
#

minor differences at worst

#

and if you just asked what a replicated variable means, you're a long long way from distributing a multiplayer game

old hamlet
#

Before i had to enable steam sub system and add the script to engine file , but now it's all deferent

winged badger
#

i suggest checking pinned messages on this channel and reading through Cedric's network compendium

old hamlet
#

yeah but i need it to test it right @winged badger

cedar finch
#

@winged badger or anyone else. Can you tell me if my replication logic is off by looking at my screenshots above? I can explain my logic. So "Event Possessed" is Server I belive so I set a RepNotify variable in order to execute the RepNotify logic for both Server and Client. That logic updates the owning player's HUD values. I added the extra "UpdatePlayerHUD" in eventPossessed to try and make the Server players HUD update but it won't update. As of now only Client players HUD updates on Possession. Please let me know if my logic is off.

winged badger
#

why are you forcing pushing HUD values into the HUD?

#

most of the time HUD can just grab them on its own

cedar finch
#

It can get them I think my naming of my event is what's misleading. It is updating the HUD's Pawn. So when a player dies and I respawn another pawn to possess I have to update the HUD to that new Pawn in order to recieve the new health values

winged badger
#

GetOwningPlayerPawn from the context of HUD is always the possessed Pawn

#

so you don't really need to push it

cedar finch
#

I never destroy my HUD though. Will that cause errors when I don't have a possessed pawn?

winged badger
#

nope

pallid mesa
#

you'll have to handle that

winged badger
#

some weirdness unless you handle invalid pawn in between possessions though

#

but you can just bind visibility to GetOwningPlayerPawn->IsValid

pallid mesa
#

it is always sane to check validity before doing any kind of operation with the owning pawn

#

if you are not sure of the type you can always use an interface

cedar finch
winged badger
#

as long as you connect the Owner pin

#

GetOwningPlayerPawn is the possessed Pawn from the context of Widget as well

#

so you don't have to set it, destroy it or recreate it

cedar finch
#

I'm still not sure what I need to do. I set the owning player as a variable in order to retrieve the health and stamina variables from my ThirdPersonCharacter.

#

So your saying I don't need to update the HUD's owner if I use the GetOwningPlayerPawn

#

But I am using it but I guess in the wrong place

cedar finch
#

Well I'm lost. I understand that the "GetOwningPlayerPawn" is the possessed pawn for the widget but you have to update that or call that event again to re-establish the new OwningPlayerPawn right? Because when the original OwningPlayerPawn is destroyed, the widget will have nothing to reference and stop working. Then you have to re-establish the connection between the new possessed pawn and the widget. Am I just stupid and missing your point? I feel like this is easy and I'm making it harder than it has to be.

#

@winged badger So if I add a delay of 1 second to my Event Possessed my HUD updates perfect for server and client. But that leads me right back to square one which was getting rid of delays in multiplayer. ๐Ÿ˜ฆ

winged badger
#

no

#

when possessed pawn changes GetOwningPlayerPawn will get the new one

#

its not a variable

#

its a function

#

it doesn't need to be updated

cedar finch
#

I get that

#

But how does the widget that is using the GetOwningPlayerPawn keep running. When my pawn is destroyed the widget stops ticking

#

right?

winged badger
#

nope

#

its still valid

#

its lifetime is managed by the HUD

#

which doesn't get destroyed until the controller is destroyed

cedar finch
#

I'm just confused as to how the widget which has nothing but a construct event knows when to update. I know you say it always lives and isn't destroyed but I can't figure out how to make it work.

#

When a player dies and is a spectator their widget will just run once and be invalid because there is no OwningPlayerPawn right? Then it will just sit empty.

#

I'm not arguing with you I'm just trying to wrap my head around it all

#

People like you know the best ways to create these things and I want to learn. The internet is just full of people putting healthbars inside "event tick" and other crap that is not right. I'm trying to learn the more correct and efficient way.

winter plover
#

you can use delegates

#

delegates are sorta "events" that you can tie to a specific function

#

you can define one on your character (call it "HealthChanged" or something along those lines) and bind it to the widget

#

then every time you futz with the health in some way you can invoke that delegate, and your update func will run

#

there's a bunch of different types of delegates, the wiki might be a good place to start looking

#

and yea checking health for changes every tick is not necessary at all

#

so good on you for having the foresight to inquire for better solutions

#

@cedar finch

#

.

Anyhoo, I have a problem of my own to fix. I am trying to make characters walk on a physics object, and I am having some rubberbanding issues for the player who is doing it, from another observer's POV no issues are noticable.

#

I suspect there's some oddity going on with the clientside prediction fighting incoming replication updates, but as far as I know this shouldnt be an issue right?

#

normal movement on static surfaces doesn't rubberband like this, so what's technically different with this?

winged badger
#

@cedar finch with that disposition, i would advise you to start looking into c++

#

while you might make a functional game with BP only, its just not the same

#

unless you collapse the widget it will update itself, with its own tick

#

note that using GetOwningPlayerPawn might result in a lot of casting

#

i say might, because if your first Pawn is destroyed, then you can make a variable of your specific Pawn/Character type

#

and make a function to Get it

#

that checks if the variable is valid, if it is, returns it and if its not casts it to your specific Pawn class, stores it into a variable and then returns it

#

the only downside of that approach is that it can't be BP Pure

#

@winter plover if that material affects movement in any way, you're in for some fun times

#

because iirc CMC does not handle that out of the box

winter plover
#

Im not sure, it's just something I pulled from the engine content

#

it's the same with the tables you can see in the background

#

I just wanted something better for the clip to show

winged badger
#

physics can't be easily simulated

#

and it has too much data to replicate

winter plover
#

I am aware of the general issues

#

but this right here doesnt seem to be much of a bandwidth issue

#

since the 3rd observer sees it just as it should be

winged badger
#

but 3rd observer doesn't have a simluation at war with the server

#

so something about how the movement is processed is different

#

on server and on owning client

#

and its outside the tolerance margins

#

which i imagine is not news

winter plover
#

yea I figured so much

#

although shouldnt client side prediction take care of this?

#

evidently it seems to be somehow possible to walk on a phys object

winged badger
#

provided it has exact same state for the object you're walking on, it should

winter plover
#

right

#

so when exactly does a server revert a client's position?

#

when it's local position is further away than some tolerance right?

winged badger
#

client sends input, server and client both apply it

#

client remembers its steps

#

when server sends an update, client takes it and applies steps it took since the time that update was sent

#

if the positions are close enough, it won't get coerced

#

client also sends its position to the server somewhere in there (not sure where exactly) and if the server decides its close enough, it will accept the clients position

winter plover
#

so could it be that because of some very minor discrepancies in the phys obj's state, the character gets knocked slightly out of tolerance?

winged badger
#

or launched into orbit, physics is funny that way

winter plover
#

well thats not the case in my current version of things

winged badger
#

altho what you are experiencing doesn't look like "slightly out of tolerance"

cedar finch
#

@winged badger Thanks I think I will start using C++. Blueprint is getting annoying. I was a big part of the Call of Duty Custom Zombies community so it should be kinda similiar. Call of Duty had some kind of C++ "ish" type of language.

winged badger
#

but in some cases, even a floating point error can result in a bounce that is 90 degrees off

winter plover
#

it might be worth noting

#

sometimes no rubberbanding will occur for long periods of moving

#

it's most noticable when starting or stoping to move

#

dunno if thats relevant

winged badger
#

ok, so your acceleration is fucked, probably

winter plover
#

mhmm

winged badger
#

i personally hate doing network in BP

#

the idea of RepNotify firing on server, and worse yet - even on clients if they set the variable themselves locally

#

drives me insane

winter plover
#

to be honest, that could be helpful behavior sometimes

#

sometimes I wish it was that way in C++

#

when changing a variable requires a bunch of extra work

winged badger
#

it might be slightly convenient

#

but not being able to separate client and server side logic cleanly annoys me far more

winter plover
#

doesnt BP have nodes for that?

#

but yea I generally avoid BP for anything that isnt just light scripts or setting up specific manifestations of c++ classes

#

I find it generally more efficient than node spaghetti

winged badger
#

my c++ does the heavy lifting

#

BPs just have UX and leaf logic

winter plover
#

yea p much as it should be

#

has there ever been a huge "pure" blueprint game?

#

I cant imagine that stuff being very maintainable as a codebase grows

winged badger
#

victor was pasting something about Contahion VR

winter plover
#

besides just missing some powerful stuff

winged badger
#

not sure how huge it is though

#

or ways to handle simple stuff, like structs, in a way that is not insane

winter plover
#

what does bp do with them that makes them not sane?

winged badger
#

you can't use functions, you need a side of a house worth of space if you want to do anything by ref

#

you can't set individual members, just the whole struct

winter plover
#

oh right that

#

yea I remember now

winged badger
#

plus the other stuff, like no delegates, no specialized types

winter plover
#

I think they have delegates

#

thats what the red square thingies are for

#

dont work as nicely tho iirc

winged badger
#

in BP, they are just variable containers

humble zealot
winged badger
#

make a variable for a DoorState, or bool bOpen

#

RepNotify it

#

and open the door inside OnRep function for it that is autocreated

humble zealot
#

this is my current bp for the door

winged badger
#

so instead of wiring all that to E

#

make a custom event

#

that has all the logic afterwards wired to it, with boolean input (cleaner that way)

winter plover
#

be mindful of collision with doors by the way

#

and object sitting still infront of it might glitch thru

#

happened to me a bunch already

winged badger
#

make IsClosed replicated with notify

winter plover
#

havent really found a great solution yet :/

winged badger
#

and from its OnRep_IsClosed

humble zealot
winged badger
#

call that event

#

yeah, just push the IsClosed as a parameter on it

#

instead of plugging it directly into the branch

winter plover
#

is that really necessary though?

#

I like to just use events as a "hey something happened" kinda thing

winged badger
#

it is cleaner, i think

winter plover
#

and let the func figure out the rest

humble zealot
winged badger
#

also

humble zealot
#

sorry bit nooby at this

winged badger
#

your client can't open the door

#

input actions are local only

#

so they need to be sent via the Servevr RPC

#

and you can't do that inside the door BP, as your PlayerController is not the door's ultimate owner

#

so you need to put the input event inside your PlayerController or Pawn

humble zealot
#

oh

#

i dunno how to do all that part

#

๐Ÿ˜ฆ

winged badger
#

then call a ServerRPC (custom event, runs on server)

#

and from the ServerRPC you reference the door and open it

winter plover
#

you want to already have a server RPC somewhere in your "Use" function

#

to tell the server that you wanna use a thing

#

before you invoke anything on the door

#

because your client is only allowed to invoke RPCs from actors that they own

winged badger
#

There are other issues, like Overlaps are running both client and server side ๐Ÿ˜„

#

so whatever you connected to it will execute on both

#

separately

humble zealot
#

ill have to look for a tutorial as i dunno where to start with this stuff

#

:/

winter plover
#

it's more of a thing about how you design your code

winter plover
#

there are certain limitations you have to account for

winged badger
#

start there

#

@winter plover one can't absorb all that in one 5 minute chat

winter plover
#

yea, just saying, there isn't exactly an easy tutorial for this

#

it has to be learnt over time

winged badger
#

nor is it important one watches for collisions when trying to wrap one's head around networking ๐Ÿ˜„

humble zealot
#

eek i cant do this ๐Ÿ˜ฆ

winged badger
#

sure you can

#

just prepare for some faceplanting until the end of the year or so

humble zealot
#

not spending a year on a door lmao

winged badger
#

well, good news is - there is only 3 weeks left

#

which is how long it will take you to get a basic grasp of networking from what i estimate is your current skill level

winter plover
#

mhm @winged badger there's another oddity that I can replicate better

#

that one root motion slide actually has no rubberbanding whatsoever

#

walking straight forward still rubberbands from time to time

#

so I dont think it's just the acceleration

#

I looked up a bunch in the code

#

and it seems like there are whole other replication routines for "based" movement

#

ie. when standing on anything

#

ill try and see if I can find anything there

#

I imagine that the phys obj itself minorly moving is triggering some updates

fluid axle
#

How hard is setting up multiplayer for a battle royal?

winter plover
#

how much networking experience do you have

fluid axle
#

0 but I have a friend that is very well versed in it

winter plover
#

well with zero I wouldnt shoot for BR yet

humble zealot
#

BR is probably best if you are 100% at networking

fluid axle
#

Even if i have my friend? lol

#

and im not going to just give up.

winter plover
#

doing BR requires you to be able to absolutely optimize the hell out of your netcode

#

it's not something you can just tackle as a beginner

#

actual studios have had trouble with it, because it aint trivial

fluid axle
winged badger
#

or as one person, unless you have a few years full-time to waste

fluid axle
#

i said i have someone that is very well versed in networking :/

winter plover
#

even then it's a gargantuan task

winged badger
#

so that someone is the one person in that scenario

fluid axle
#

gotta start somewhere

winged badger
#

doesn't change it will take years

winter plover
#

yea but why not start at something that isn't going to utterly frustrate you right away

#

something to learn the ropes

fluid axle
#

and what do you suggest?

#

i have the base down for my BR

winter plover
#

something managable, in the single digits perhaps

#

there's still plenty that can go bad there

fluid axle
#

Maybe other 'players' are just npc enemies or?

winter plover
#

the specifics I'll leave up to you

#

but wanting to make a BR game as a first project is just as silly as trying to tackle an MMO alone

#

it's not going to end up satisfyingly

fluid axle
#

yeah but if someone just gave up because of that then we wouldnt have anything

#

it only took two people to create an airplane lol

winter plover
#

im not saying give up, but adjust your goals to be realistic

#

and those two people had lots of experience

#

they didn't just make over the weekend

fluid axle
#

they started in a bike ship

#

shop*

winter plover
#

and that's where you should start

#

run a bike shop first

#

before trying to build the plane

fluid axle
#

im saying they had zero experience with making airplanes cause airplanes didnt exist.

winter plover
#

they had experience in engineering and physics

#

which is what made that possible

#

you have no related knowledge to make a BR game happen currently

fluid axle
#

Im not saying it'll happen over night but slowly sure

#

Make it so a few people can connect at a time and work from there

#

like 2 then 3, etc etc etc

winter plover
#

perhaps one day, but if you set your goals to high you will just be disappointed and lose motivation

#

trust me, you aint the first

fluid axle
#

I know im not but i can work towards the BR part of the game

#

Like i said I have the base down for it.

winter plover
#

I'll leave you to figure this lesson on your own then

forest bolt
#

Hi guys.

#

I new from here

#

i'm using C++ on a project with online subsystem and I need to do something like this.

#

any tips?

humble zealot
#

@fluid axle quick question. What is it you want to get out of a BR, what would make yours stand out to the current BRs? If I'm honest you are gunna have to be either very good at it or make it unique which is near impossible as most has been done.

forest bolt
#

Thanks @humble zealot !

fluid axle
#

@humble zealot You'll basically be flying through the air and using spells to fight enemies. You'll be able to combine spells to make them more powerfull.

spiral badge
#

Guys anyone have some tip?

keen halo
#

Hey,
Does anyone have experience in smoothly updating a characterยดs location to leap from one location to another ( without using Launch Character / Impulse ) on a dedicated server.
The goal is to make a leap jump with dynamic jump lenght.
Just updating location on server gives a choppy / laggy result and itยดs the same if I do it on both client and server.
For testing purposes I am doing this on tick - so the update frequence should not be an issue.
Also tried the same approach with a timer set to loop on 0.01s.

winged badger
#

as long the destination is in sync

#

you can temporarily disable the CMC's server updates

#

i do not remember where exactly, but its usually a go to solution with really high speeds

keen halo
#

I will look into that, thanks

#

@winged badger Seems like turning of Replicate Movement temporarily does the trick judged by quick tests. Thanks.

humble zealot
#

@winged badger I think I've got the door BP how it should look but I have no clue how to tell the server to open it in the player controller

#

Also if I want to use lockable doors for the owner of the building how would that work

thin stratus
#

Owner of the Building should maybe not be handled with the Ownership system of UE4

#

For that I would really just make a parent class for your building elements that has an additional Owner Variable made by you, as well as an Array of playerControllers that defines who's allowed to open the door.

#

And to tell the Server to open the door is realtively easy

#

In your PlayerController or Character, where you do the E press

#

Or whatever button press

#

You perform a ServerRPC

humble zealot
#

I don't know how to do it

thin stratus
#

And in the ServerRPC you perform the LineTrace to the door

#

and tell it to open that

#

Welp I just told you how

#

the "How to create a ServerRPC" is nothing I will repeat here, as you have my Compendium and a lot of other resources to learn that

humble zealot
#

I'll have a look on Google again

thin stratus
humble zealot
#

is it possible to put a blueprint inside of a blueprint?

thin stratus
#

Kinda

#

ChildActorComponent would allow that

humble zealot
#

I'm going to allow the user to build the shack, then build the door then snaps the door onto the shack, that way i can control it better

broken heart
#

Hi, does anyone know how to deal with the client spawn delay? My issue is explained better here:

winter plover
#

BeginPlay should fire after the actor has been fully initialized

#

can you post your snippet?

thin stratus
#

You shouldn't use GameMode BeginPlay to spawn the loadout

#

Makes 0 sense

winter plover
#

yea should be on the character's beginplay

thin stratus
#

@broken heart

broken heart
#

The character's begin play triggers before it fully spawns as well

winter plover
#

shouldn't be

thin stratus
#

No it doesn't

broken heart
#

Visually the camera hasn't adjusted yet

#

but the character porbably has spawned

thin stratus
#

That's just the ms delay between the replication causing the client version to spawn

#

You can already spawn the loadout on the server though

winter plover
#

make sure thats serverside though

#

yea

thin stratus
#

GameMode BeginPlay is 100% wrong

#

You are testing in the Editor and you already try to fight the delay

#

What do you think happens if someone joins a minute after the Server?

#

BeginPlay is long gone

broken heart
#

Ok, thanks guys

#

Just tried spawning in begin play of character and it worked

#

But the camera takes a bit longer to adjust, should be fine though

winter plover
#

that might be because you are spawning straight into the character

#

if you had a "prepare" screen of some sort

#

with some sort of external camera looking at the level or whatnot

#

it's gonna be less noticable

broken heart
#

True

#

thanks ๐Ÿ˜ƒ

fluid axle
#

@humble zealot did you get a chance to see my answer to your question

hasty adder
#

This might be my dumbest question yet. When you connect to listen or dedicated server. Are you still able to use gameinstance to hold variable or is this destroyed in that transition? Ie your in main menu and your using it to jump to a host. But can you store something there for the return?

meager spade
#

Gameinstance is per executable

#

Gets created at Launch, Destroyed on Exit

#

only accesible from Local, not available to other clients

broken heart
#

I've been getting a replication error where clients possess the server's pawn when a dedicated server is not run, but when a dedicated server is run my game works fine.

hasty adder
#

Ok so technically I can have a variable say enum current mainmenu and join a server and when returned to main menu call the same umg then without needing to reload a save as the variable should stick till they exit the game

#

Mainmenu.level.bp begin play switch on enum to move camera etc getting it from gameinstance

thin stratus
#

@broken heart You are most likely using GetPlayerController0

broken heart
#

what should I use instead?

thin stratus
#

The controller who should posses it

#

Possession happens on the server. GetPC0 refers to the Server at that point

#

It depends on where you call it

#

Usually you want to pass the controller of the player who wants the pawn along

#

@hasty adder Technically, yes.

#

Although Widget Objects might be cleared

#

So i would keep it at non spawned or created objects

#

Plain objects might work though

broken heart
#

When I set "Auto Possess Player" to Player 0, the server can no longer move or look around, but the other clients now have their own controllable characters

#

And in standalone mode the first player cannot move either

thin stratus
#

Make sure they don't have or need a reference to something that is in the world and might be destroyed on transition

hasty adder
#

Well thatโ€™s what I mean I can call various begin play at mainmenu world and with menu pawn just seeing if itโ€™s valid idea to use game instance to hold the state of where they were before going to another world

#

Only world stuff is just where the camera should be for a given menu

thin stratus
#

@broken heart Auto Possess is for splitscteen

broken heart
#

So it should be set to disabled?

thin stratus
#

Your best bet is to either use the DefaultPawnClass in the Gamemode

#

Or to use something like "InitNewPlayer"

#

There are some useful functions you can override in the gamemode

broken heart
#

I already use my pawn class as the default in the game mode

thin stratus
#

@hasty adder I wouldn't save it like that

#

A simple enum is fine

broken heart
#

but when I don't use a dedicated server the pawns doesn;t spawn for my clients

thin stratus
#

But lots of info about some actors is better located in a savegame of sorts.

hasty adder
#

Right on, sorry if Iโ€™m not explaining well, 007 at work with chat. I just need a enum saved on game instance to have a saved state to work with that gets set before going to another world and used when returning

crude slate
#

Hi guys

#

anyone knows why i goting a Not replicated component in my UActorComponent, Im setReplicated and put on DOREPLIFEREP

#

but the error just persist only on steam subsystem

winged badger
#

subsystem has nothing to do with engines replication

crude slate
#

idk why in PIE i can play with 2 windows

#

and from steam

#

i got crash

prime axle
#

Quick question - When I do a console command "Open 127.0.0.1" On my dedicated server
I join, as I can see the "Join succeed" log. But I don't spawn as a character?

Is this intended behaviour? Am I supposed to spawn my character somewhere?

fallen oracle
#

Did you place PlayerStart on your map?

prime axle
#

yup; 2 even

fallen oracle
#

set up default pawn in your game mode?

prime axle
#

yup

#

I spawn with my custom HUD displayed - so my gamemode is definetely functioning

#

but no character

fallen oracle
#

hmm

prime axle
#

I basically fly around as if I was in the editor doing stuff. just free flight

fallen oracle
#

do you get any logs? if character spawn is attempted, but failed, there should be a log

#

c++ or bp only?

prime axle
#

both kinda

#

character is c++ but made into a blueprint

#

and it's the blueprint I set as my default pawn

#

(the intention was to be able to change meshes dynamically in the editor without having to rebuild)

fallen oracle
#

One common problem i have, is that somewhere in the c++ code, i forget to call parent function when overriding

prime axle
#

ye; the Super:: ones

#

checked; didn't miss any

fallen oracle
#

i'd check BeginPlay on gamemode, gamestate, player

#

hmm

#

when u run the game from editor, without dedicated server, just offline, are you using a character placed in the level, with auto possess, or is it placing your character on the playerstart?

prime axle
#

placing it on the playerstart

fallen oracle
#

then crap, im out of ideas, sorry :/

prime axle
#

and my dedicated server is loaded onto a map called "Main"
My player however starts the game in the "MainMenu"
If I were to be in the editor and in the Main map and I press play; it spawns my character with no problem. But when going from the main menu into -> Join server at IP XX.XX.XX.XX; Then I don't spawn as a character

#

damn :/ thanks for the attempt anyway.

mental light
#

Hi, is there any way to launch a packed game built with unreal engine headless without build the source code? i don't want it to be optimized, just want to run a dedicated server asap

#

any kind of flag that i can pass at cmd

full bane
#

dedicted servers only work with source build

mental light
#

:/

#

no prob, i will download the src then

lost inlet
#

anyone run into an issue in a networked game in a char movement component where each component of the Velocity gets truncated to an integer?

#

ReplicatedMovement.VelocityQuantizationLevel ๐Ÿค”

grand kestrel
#

Nope

#

Never in all my years ๐Ÿ˜†

#

My work is primarily character focused too

prime axle
#

is it normal for the GameState to reinitiliaze itself aftera World->ServerTravel()?

rare cloud
#

@prime axle since you make a server travel UWorld is recreated

#

so Game State, Game mode, etc.. are recreated too

#

you can use UGameInstance to copy data

prime axle
#

What would be the way for me to go about doing the following then (in regard to GameMode/GameState/PlayerState/etc...)

I built a dedicated server and got it up and running
I want players to connect to it, and when they do, they find themselves in a lobby map (I currently have this lobby map set as the server default)
And after X amount of time is passed the entire lobby is moved to the MainMap where they actually begin their deathmatch.

Currently I just have a RemainingTime varibale in my GameState and a Timer in my GameMode that if it reaches 0 it simply does a Servertravel(). I also then do GameState->m_RemainingTime = 500;
But obviously that value doesn't stay; it re intiliazes to the constructor value I set in gameState.

Hopefully this makes some sense....

thin stratus
#

Have a GameMode for the Lobby

#

and one for the actual game

#

setup your default values for each properly

#

There shouldn't be any problems for what you are trying to do

prime axle
#

aight, makes sense! thanks Exi

#

btw, huge thanks for your network compendium

halcyon abyss
#

Hey guys!

#

What is a good way to check if a pawn is controlled

#

But I have to check it on the client

winged badger
#

IsLocallyControlled() if you want to knnow if its controller is local

#

IsPlayerControlled() works if you want to know just if its controlled by any player

#

that one works by checking if the Pawn has its own PlayerState, and that PlayerState is not a bot

halcyon abyss
#

...mmh

#

player state ...yes

#

but like you said

#

bots dont have a player state

winged badger
#

they can have it

#

they don't by default

#

those are both APawn functions

halcyon abyss
#

those are both APawn functions .... Both which

#

cool

winged badger
#
bool APawn::IsLocallyControlled() const
{
    return ( Controller && Controller->IsLocalController() );
}
bool APawn::IsPlayerControlled() const
{
    return PlayerState && !PlayerState->bIsABot;
}
halcyon abyss
#

ok cool

#

how do I set it up

#

so that a bot has a player state

#

?

winged badger
#

don't know off the top of my head

#

search for references to PlayerState in AController/AAIController, shouldn't be difficult to find

halcyon abyss
#

Alright

#

thanks a bunch ๐Ÿ˜ƒ

prime axle
#

Would a MainMenu and Class Selection stuff be it's own GameMode (talking about Multiplayer game)? I have an issue that my default pawn spawns even though I don't need it at all. So tryna see what the best fix could be

fossil spoke
#

You dont have to define a DefaultPawn on the GameMode, you can leave it as None if you intend to Spawn the Pawns yourself manually.

prime axle
#

I have my GameMode set to None in the world details in my MainMenu map, but it still spawns my character,
My guess is that it used the default pawn defined in the Project Settings?

#

I checked and I can't set Default GameMode in my Project Settings to None... so should I create a new GameMode with just None everywhere? ๐Ÿค”

fossil spoke
#

The GameMode in your World Settings GameMode Override for that level will always be used.

#

The settings inside the WorldSettings will always be used.

#

The DefaultGameMode is only used if none has been defined in the WorldSettings

prime axle
#

But what if I want None to spawn though within a certain map?

#

Do I need to create a custom GameMode filled with None?

#

Cause right now my MainMenu Map GameMode override is set to none

#

so it tries to spawn the default from my Project Settings

fossil spoke
#

Can i see your WorldSettings?

#

So i can be certain we are talking about the same thing

prime axle
fossil spoke
#

Ah ok, yes you will need to make a custom game mode

prime axle
#

default modes in ProjectSettings

fossil spoke
#

Yep, make a GameMode for your MainMenu and then set it on the WorldSettings

#

You will then be able to set the Default Classes there directly

#

For that GameMode

prime axle
#

And then I select None for DefaultPawn ye?

fossil spoke
#

Yep

prime axle
#

Quickly another question.
I select a class I want to play as in this MainMenu and when I press Join I want to spawn with said class. But since I'm using a custom GameMode with like None Everywhere, how would I replicate my choices best between moving between GameModes? ๐Ÿค”

fossil spoke
#

You have a few options.

#

Im assuming your meaning when you travel to the Gameplay level from the MainMenu how do you recover the choice players selected? Correct?

prime axle
#

Exactly