#multiplayer

1 messages ยท Page 631 of 1

dark edge
#

You should just do the server check in event any damage. The way you have a set of right now, any client can just say yep increase the score and it would just happen no matter if damage actually occurred or not

normal violet
#

yea but like I said, it's working, but because of the low net update frequency of playerstate it can take a second before the score gets updated

#

Ahh ok I get you Adriel. Thanks

dark edge
#

If this is a shooter, ignoring prediction, the only client to server RPC should be when you fire the shot. Prediction makes things a little bit trickier

normal violet
#

I will ignore prediction for now ๐Ÿ˜‰

bronze summit
#

Try making a delegate in the pawn and hook to it in the HUD class and setup a bind then Fire -> Client/Server predict -> Both update client already fires and server validates -> Server overwrites if incorrect

normal violet
#

Ok thanks for the help guys, even after reading exi's guide multiple times it's sometimes still hard to wrap my head around. I do not have a programming background, so that might be the issue ๐Ÿ˜‰

#

Appreciate the help

chrome bay
#

You don't want to predict things like score, there's no sense in it at all. Just accept that some stuff will be inherently latent, it doesn't really matter anyway

#

You want to predict as little as you can possibly get away with to make the gameplay acceptable. If you take it too far, you just end up with a mess of problems and race conditions that area really hard to debug once you actually ship.

bronze summit
#

So in this case it would just be best way to setup a replicated variable being set only on server and hook to the OnRep of that variable? Just trying to get my head around it myself

normal violet
#

That sounds like the "fastest" option to me as well

#

But like I said, I'm far from being an expert ๐Ÿ˜‰

winged badger
#

@bronze summit you predict only things that your player needs to have an immediate feedback on

#

like pressing fire and seeing the gun fire immediately, not 0,2 sec later

violet citrus
#

Hii Do we need to buy a server for multiplayer game for Android

winged badger
#

anything else, can wait for server

night tartan
#

Hi, I've got some a question about the PlayerState...it appears that GetPlayerID() is really not a good way to differentiate "unique" players (I'm seeing the same ID used on a LAN connection). Is this only useful in a real subsystem that isn't the null? Is this generally a bad way to ID the uniqueness between players?

#

I tested by having BeginPlay() print out the ID and I'm seeing non-unique numbers print out when players join the session

winged badger
#

we have SteamID as UniqueNetID

#

for Lan/Null you'll probably need to improvize

night tartan
#

gotcha

#

okay, yeah, I have Steam implemented, but I'm testing on LAN

#

thanks

terse iris
#

omg, i found out my problem with the player state being invalid, i forgot to pass in the player controller in the blueprints ๐Ÿคฆโ€โ™‚๏ธ

night tartan
#

BeginPlay() on the PlayerState fires twice when a client joins, once for server and then once for client...will the UniqueNetID be the same for both, or is this going to be different based on where the BeginPlay() executes?

night tartan
#

How would I go about preventing the ListenServer from executing functions twice?

#

the host is adding themselves to an array twice (and apparently "AddUnique()" is not catching it)

night tartan
#

so, I think I've hit a but

#

bug*

#

PlayerState's BeginPlay() fires twice

#

I attached a print to it to test if this is happening once on server and once on client, and it's twice on client, with two separate BP instances (C_0 and C_1)

#

does this make sense to anyone?

#

Nevermind, it's firing for every replication when a client joins of already existing player states

waxen nexus
#

Hello everyone, I'm having an issue with Gamelift/AWS. Using UE 4.25/6 source, VS 2017/19. I am able to build both plugins to source (even with 4.26), and everything looks fine... until I go to build the dev server, no matter which release of UE and/or VS I try. Then I get errors, and most importantly, no server build. Any ideas?

vital steeple
#

does repnotify trigger when players join? i need to figure out how to handle the state of an actor for players that might join a session later

#

or do you just need to run stuff when the server hands out a new player controller to a joining player

distant wave
#
{
    if (Controller)
    {
        return Controller->GetControlRotation();
    }

    return FRotator(RemoteViewPitch / 255.f * 360.f, GetActorRotation().Yaw, 0.f);
}```

Hey guys, I was watching this tutorial and I don't understand why RemoteViewPitch was divided by 255 and multiplied by 360. It is a uint8
#

Is there any way to get the remote view yaw?

candid escarp
#

Very important question for me: Is there a difference between testing with clients only in standalone mode and the other modes like new editor window etc.? In standalone mode my game is quite... buggy and doesn't behave as it did in other modes

hallow sand
#

Can't figure out how to attach the override audio listener node to my ear mesh in multiplayer. Any help?

dark edge
#

It's good for state driven stuff.
1: Here's the state (variable value)
2: Do something with it (function)

sullen kernel
#

@distant wave I think that division/multiplication is a way of converting it from a range of [0, 255] stored in the uint8 to [0, 360]

#

so if RemoteViewPitch had a max value of 255, that would translate to 360

vital steeple
#

@dark edge roger, thank you! working on a multiplayer replicated destructive foliage for larger objects like trees. need to maintain which objects were destroyed for gameplay reasons (collision, vision etc)

dark edge
dark edge
distant wave
#

Thank you! I checked the Pawn.cpp and .h and I noticed the comments they made

#

I also created my own RemoteViewYaw just like they did with RemoteViewPitch

#

So now I replicate that head rotation nice and smoothly

jaunty onyx
#

is there any video/tutorial/project where I can see a really good working **multiplayer **melee combat system ? Like action combat (chivalry / mount and blade etc...) thanks ^^

graceful abyss
#

Hello, would it be fine, if I post a lengthy question here?

meager spade
#

If its too lengthy use a pastebin, but sure

graceful abyss
#

ok, thanks

#

one second

meager spade
#

by too lengthy i mean like 2 posts or more ๐Ÿ˜„

graceful abyss
#

dunno, I thought I'd do it like this anyway, as it's some paragraphs

meager spade
#

ah]

#

there was a number of issues in 4.24 version of SteamOSS

#

ours got fixed upgrading to 4.25

graceful abyss
#

oh ok. That sounds like the way to go then

#

thankyou for your help.

meager spade
#

4.24 to 4.25 is quite painless

#

we had just 1 issue was our whole game went bright

#

but that was cause they turned some feature on by default, can not remember what it was now

high lotus
vital steeple
#

thank you!

barren patrol
#

In a multiplayer game setting, what would be the best way to give each player their own dedicated instance of a room while still connected to the main server? E.g. they are on a multiplayer map, but can enter their own instance of a dungeon if they go through a door.

#

Broad strokes the two approaches I've considered are: Spawn a new room/dungeon instance for each player programmatically on the fly. Or (b), use a single dungeon room and take advantage of net relevancy to isolate players from each other (plus any mobs/items/etc in their dungeon instance)

#

for (b) I'm pretty worried of introducing bugs if I don't get relevancy correct for every player, mob, ability, and effect. It would be pretty wild if a stray projectile from someone else's instance killed your boss, for example. Or if you could see someone else's loot on accident.

#

For the first idea, I'm having trouble with doing this programmatically using a BP actor, because you need multiple actors. At minimum, the static mesh and a nav mesh bounds volume. What kind of primitive can I use to load on the fly? Is sub-level streaming something I should look into?

#

Also, I tried generating nav mesh bounds programmatically and it had a lot of problems. It feels like I'm doing this the wrong way / uncharted path

rich ridge
nimble sinew
#

So i've got this error on my client: LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)

#

and my PostLogin is not firing in my GameModeBase- I'm wondering if these two things are related?

rich ridge
barren patrol
#

Thanks @rich ridge

nimble sinew
barren patrol
#

So just have one massive Nav mesh volume that can accommodate potentially 10s of dungeons?

#

I have an existing Nav mesh volume for the persistent map

rich ridge
#

Don't overlap dungeon acotrs. It might give you unexpected behaviour

barren patrol
#

Yeah, that possibility concerns me

#

What do you mean a โ€œgrid of 10โ€? Is that a Nav mesh volumes thing or you just mean how I lay out the dungeon actors efficiently?

nimble sinew
# rich ridge Are you using any OSS?

Something interesting is that this only happens when running my Development Server build and Development Client build together- but when I open the Editor and use PIE the post login fires. and i dont get that warning for OSS either.

rich ridge
#

I meants like make grid like 5X2, or 2X5 grid and spawn every dungeon actor at center of each grid for each player.

barren patrol
#

Yep, makes sense

rich ridge
barren patrol
#

Reading about replication graph now, it sounds very powerful

#

Make a list of special Actors that are always (or never) relevant to certain clients. A similar always-relevant list node could be made for individual players, or for teams of players.

#

^ from the docs

rich ridge
barren patrol
#

So I could potentially reuse a single dungeon, with each boss/item/player combo on its own list

nimble sinew
rich ridge
rich ridge
barren patrol
#

The idea is that players can play together on the map, but when they go into a dungeon room to fight the boss, itโ€™s a private instance so they donโ€™t get interrupted by other players

nimble sinew
rich ridge
#

Advanced session plugin uses null, and it help you to avoid boilerplate codes and setup

nimble sinew
rich ridge
#

Yes it's bp wrapper.

nimble sinew
#

Yeah so ideally all i need to know is what i need to change in c++ to make this work

#

I'm not manually creating sessions anywhere here- maybe i need to do that?

rich ridge
nimble sinew
#

ehh debugger wont tell me much i dont believe

#

honestly it comes down to a lack of understanding of the unreal multiplayer system i think for me

rich ridge
#

No it will tell, just put the breakpoint

#

And navigate

#

Put breakpoint in Login, PostLogin function of GameMode

#

And you would also see in which case that error warning is shown.

nimble sinew
#

that warning is always shown when using standalone client/server

#

and postlogin doesn't fire, so im not sure how a breakpoint there would help

#

i suppose i could override prelogin/etc too and see how far it gets

#

okay well, i restarted my computer and postlogin is firing now...

#

thats odd

winged badger
#

only time PostLogin doesn't fire is after Seamless Travel

#

as there is no logging in involved there

drowsy zodiac
#

should super call InitDeath_implementation()? or just InitDeath()

thin stratus
#

Implementation

drowsy zodiac
#

Ty

drowsy zodiac
#

FRootMotionSource_MoveToForce - Is there a way to maintain the velocity after rootmotion ends?

#

MoveToForce->FinishVelocityParams.SetVelocity = GetCharacterMovement()->Velocity; -?

#

I think this might do it - MoveToForce->FinishVelocityParams.Mode = ERootMotionFinishVelocityMode::MaintainLastRootMotionVelocity;

harsh ice
#

join or find session is not working mobile

rich ridge
#

Which class is this?

winged badger
#

that is terrible ๐Ÿ˜ฆ

#

im having a hard time even imagining the intent

#

initial replication of members goes before BeginPlay @rich ridge

#

but we have no clue what NewVar even is

winged badger
#

which has what relationship with the Actor running that code?

#

the client Actors call for BeginPlay comes from PostNetInit function

#

when spawning an Actor from replication

#

you still didn't even tell us what the problem is

#

whatever you intended to do with that code snippet, its the wrong way to go about it

#

you didn't tell us what its supposed to be doing, for clients or otherwise

#

and its intent is far from clear

rich ridge
#

What he meant is, what you want to achieve?

winged badger
#

and what is the relationship between that Actor who runs that code and the CameraActor?

#

GetGameMode->GetNumPlayers->For (0 to NumPlayers - 1)->GetPlayerController[Index}->ClientSetViewTarget(ViewTarget)

#

is the least resource intensive way to go about it

#

where ClientSetViewTarget is a Client RPC event on your PC that takes input of type Actor that you need to make

#

that just calls the SetViewTarget on provided actor ref

#

close

#

first you need to reduce NumPlayers by 1

#

since the controllers are zero indexed

#

second, that will call setviewtarget on their server instances

#

to get clients to locally set them you send a client RPC

sullen kernel
#

The GameMode only exists on the server. The client RPC will run the code on the client who owns the actor

#

Where is that BeginPlay?

kindred widget
#

What is the actual use case though? Are you just trying to set a newly joined player's camera view target to something in particular?

#

You can probably just have the PlayerController's beginplay check IsLocalController. If true, set the view target.

#

That way it only runs on the client with the view. It won't run on the server for anything except the listenserver's controller.

#

Not really sure how to help with that without seeing what you're doing.

#

What is the view target you're trying to set the view to? Is it just an actor placed in the level somewhere?

#

This is in your PlayerController class?

#

The one you want the view target to go to?

#

Or, which actor?

#

Try this. Leave the PlayerIndex at 0.

#

GetPlayerController0 will always return the local machine's controller in client, standalone, and Listenserver machines. But the second check will also make sure that this is viable for Dedicated servers too. You could get the same thing by first checking IsDedicatedServer->Not, and removing the branch check.

#

Should run for everyone, assuming that the Camera pointer is valid at that point. What do you mean by it changes for a while?

kindred widget
#

Delays really aren't the solve for the problem though. You should really find a way to get the camera locally to do the logic immediately. But some things really just require like a loading screen to hide stuff behind until it's ready.

open quail
#

is there any way to know during logout of gamemode if a playerstate is leaving?

#

because it is not null yet

kindred widget
#

@open quail For an intentional log out? You could always set a value on the playerstate before logout. I'm not really certain if there's a good way to handle blatant disconnects.

dark edge
#

How can I start a session at game startup? I want a session to exist at main menu

#

just have an empty pre-first level that starts the session?

harsh lintel
#

I have a function that moves a character on a spiral path by using polar coordinates and calling SetActorLocation, it's called on the server on Tick(), but it looks choppy, is there a way I could make it look smooth?

hollow eagle
#

by choppy do you mean on clients? You need to run the same logic on clients to "predict" the actor's location if it's only being set on the server.

harsh lintel
#

I see

open quail
#

@kindred widget what i ended up doing although not optimal is to check whether the playerstate has a pawn or not and if not i just ignore it

twin juniper
#

so BOXTRACES Complex trace doesnt work for complex collision right?

pallid canyon
potent cradle
#

If:
-I am on a server
-I multicast
-The multicast is not reliable

Is it still reliable for the server itself?

pallid canyon
sly venture
#

Hi @thin stratus.
Sorry to quote you but your website looks down (tested by me and someone else)... Is it really down ?
Your Compendium is the best multiplayer source i've seen, i'm pretty sad but i hope it's only temporary.

pallid canyon
#

since you're multicasting from the server

potent cradle
#

Considering reliability has something to do with the bandwith saturation, I imagine...

#

But just wanted to be 100% sure

#

๐Ÿ˜„

pallid canyon
#

before you can MC though, the server has to have the data

potent cradle
#

But if I am already at the server, how could it be dropped?

#

It doesn't have to go through the network

pallid canyon
#

I honestly don't know enough about it to give a great answer, but de facto, if you are sending information from the server, you have the information on the server

#

you dont have to worry about a multicast to it

potent cradle
#

You're right, but my current logic is attached to be processed at the multicast event. That's why. Sure, indeed I could move it out though, and handle it seperately. Hence the question to be sure ๐Ÿ˜„

pallid canyon
sly venture
#

thanks @pallid canyon ! I'll save and archive this version, just in case ๐Ÿ™‚

pallid canyon
#

np

dark edge
#

Unless.... is there any way to fire up a session without having a hard load?

thin stratus
harsh lintel
#

the launch is a RootMotionForce so it's okay

hollow eagle
#

probably because the position is being reset by the server every network update, but by the time you receive those they're slightly in the past. Unfortunately there's no easy solution here - the way, for example, CMC works is that it doesn't actually apply server updates to movement immediately but instead interpolates to them over a short period based on how long ago the movement was.

#

I bet if you simulate lag (net pktlag 200 in console for 200ms of lag) you'll see it get much worse

dark edge
#

What would be the approach to late-spawn a players pawn?

#

Basically, we want our main menu to transition into gameplay seamlessly. I dont know what pawn to give them until after gameplay start

sly venture
#

Glad to know it's a planned maintenance, not an unexpected one ! Thanks โ˜บ๏ธ

dark edge
#

So i want to use the gameplay PC and Playerstate and gamemode etc, but not spawn the pawn and possess until later.

kindred widget
#

@twin juniper You need to send the vector through the RPC.

#

You play the input event on a client, and it gets it's value locally. And then you tell the server to do something with that same event's last input, which on the server will be zero, because it never ran on that actor in the server.

crystal crag
#

I wish I could find a tutorial on how to get witcher like movement while attacking. The only one I can find is really in-depth, but it is using someone's game framework and I am not really learning anything other than what options he uses to create certain behavior.

#

Which leaves me the only option of trying to reverse engineer (he provided his project for others to use) everything and figure out what the heck he is doing and why he did what he did

kindred widget
#

Click on the Event and add a parameter.

kindred widget
#

Not even really sure what you're trying to do. If you want to move a replicated object, do it on the server and let it replicate. And also do it on client separately, but let that get overwritten on the client. Predictive stuff can get semi complicated.

kindred widget
#

Physics replication is generally unreliable. With slow moving things, you can sort of work around it, but fast moving objects won't work. Only real way to do physics replication is to replicate position, rotation, linear and angular velocity. That's the easy part. The harder part is correctly setting it. For small differences, you want to only interp it a little closer to the actual location. For larger ones you'd want to override. It's the only way around the slightly random nature of physics movement.

barren patrol
#

@crystal crag you need to break down the problem into smaller pieces. it's not always easy but having an example project and a game to reference is as much as you could really hope for.

twin juniper
#

Why can't i set only owner see on my spotlight?

severe cedar
#

Does anyone know if Load Level Instance replicates automatically? Doesn't seem like it does, and I think Load Stream Level does. Do I need to manually load it on the client only if it is a level strreaming instance? Wouldn't that mean each Actor in the level is its own separate instance and cannot replicate/RPC between server/client?

placid pendant
#

any opinions on the best AWS service to save and load player save game objects (multiplayer)?

tawny parcel
#

Anyone here happen to work on the Network Profiler and be able to tell if something is a bug?

muted perch
#

How would I show a widget to all players through the game mode?

winged badger
#

though gamemode by sending a Client RPC to each controller

#

best reserved for stuff like match summary widgets

muted perch
#

I'm sending a character selection widget

winged badger
#

you know their HUDs can just bring that up on BeginPlay?

muted perch
#

Well, i'm having them bring the UI up each round

#

Like a CSGO round system then the buy phase will be a character customization screen

winged badger
#

if its critical and can be triggered when players have been on the map for a while

#

yeah, have GameMode send a Client RPC each PlayerController

#

from blueprint you can pull GetNumPlayers from GameMode

#

reduce it by 1

#

then GetPlayerController[0 ... NumPlayers-1] in a for loop

#

to get all the PCs

tawny parcel
#

@muted perch If it is a one off event that won't be spamed, you can use the gamestate to do a multicast RPC as well. Use a switch has authority node and place the widget code on remote only (if its a dedicated sever) or both if its a listen server

glad sedge
#

Here's a question - What's the difference between Network Smoothing Mode vs Linear in regards to a Character Movement Component's network settings?

#

My little racing kart game had a bit of a lag between the capsule (root component) and its mesh. Changing it from Exponential to Linear fixed it, but I'm not entirely sure why

#

well.. kinda fixed it.

dark edge
kindred widget
#

@glad sedge Most of it is just math handling. The idea being that linear will correct and interp things in a straight, simple manner. Exponential would likely correct smaller errors less, and larger errors more. You can see some of the handling in C++ if you know it. There's quite a few checks, but a lot of the large handling seems to be in the two functions at the bottom of UCharacterMovementComponent::SmoothClientPosition

glad sedge
#

Ah right. I wonder if that's why I'm seeing a big difference between my capsule pulling forward when moving around.

#

At its worse, it looks like the capsule is dragging the mesh.

#

I'm also running this off my own PC, so maybe it works a little better on dedicated server (though I don't think it would.)

craggy void
#

I'm building a lobby screen where players can select their avatar and loadout and such. I put these replicated variables in a custom PlayerState, and have the UMG widgets use the PlayerArray in the GameState to populate. If a client changes something, it RPCs the change to the server, which changes the replicated variable in the PlayerState, and then sends an RPC to each PlayerController that something has changed to they can update the UI.
The problem I have is that when that UI is updated, the PlayerState hasn't replicated yet so the new information isn't shown. If I put a Delay in the update method it does work, so the PlayerState does seem to be replicated properly. Of course a Delay is very unreliable for this, but I can't seem to find any OnRepNotify on when one of the player states in the PlayerArray has changed. I only see one in the Controller, but I need to know when the PlayerState of other players changed as well. Am I missing something?

kindred widget
#

@glad sedge Hard to say. Since it's a racing game, you may want to up the ranges a little too if you have faster speeds. CMC doesn't handle faster speeds at default settings.

glad sedge
#

The ranges being the Update Distance?

rich ridge
#

@craggy void I would suggest you populate your UI when player state is replicated.

#

And there is a function OnRep_PlayerState(), and it is called when PlayerState is replicated.

craggy void
#

Yeah, that's what I'm aiming for, but what can I listen to to know when the state is replicated?

#

In the Controller you mean? I found that one. But what if one the PlayerStates of another player has changed?

kindred widget
#

Yeah. If you lower the NetworkMaxSmoothUpdateDistance a little. It should stick a little closer in it's smoothing updates. And keep NetworkNoSmoothUpdateDistance at a reasonable distance based on your highest speed to avoid as much snapping to the actual location.

rich ridge
#

One event to multiple players.

#

Ohh wait.

#

Basically you need to loop to all available PlayerState and set the observer.

glad sedge
#

Thanks @kindred widget I'll fiddle with it.

craggy void
#

That's what I have currently, an UpdateUI sent to each player controller. I suppose I could add the entire player array to that multicast, but that just seems like sending it twice

rich ridge
#

And if your event is reliable, you will get callback for sure

glad sedge
#

I'm assuming the higher the value, the increased frequency for the packet update?

rich ridge
#

@craggy void Don't add entire PS array in event.

kindred widget
#

I don't think either of those have anything to do with actual networking. I think that they just affect how the client handles server's updates. Higher value on the first allows it to lag behind further. That's good for smooth interpolation, but bad for precision. Lowering it too much should likely cause some jittery feeling at times. Increasing it too much won't really have a huge adverse effect, but you'll see laggy movement at faster speeds. The second one just simply checks if the client is X distance from the server's last update. If so, snap it to that location cause it's considered too far to allow it to try and interp correct.

craggy void
rich ridge
#

You need to set delegates for each replicatable variable

#

Yes exactly

#

What I do in my project is, I bind PlayerState to widget and bind observer to the replicate events

craggy void
#

So basically, add a BluePrintCallable event to the PlayerState class, add an OnRep to each replicated variable in the PlayerState class, and call the event whenever one of the OnReps gets triggered.

#

And if a player connects or disconnects, multicast that to rebind the widgets

rich ridge
#

BlueprintImplementableEvent

craggy void
#

I''ll give that a try

rich ridge
#

You got the core logic

graceful abyss
#

Hello,

Again I would like ask for help on my steam connection issues, I keep having.

I have a basically working multiplayer project, but I cannot find the steam sessions, I start with my other computer (different steam acc, but same network). Finding them in LAN [without Steam] works.

Two questions beforehand, and sorry for being a dilettante. It's just so that there is no clear information anywhere on the internet on this and I have no inside knowledge of those p2p-connections are created with the help of steam:

  1. Do I need to separately download and install the current steamworks sdk and copy those dll's into my unreal engine installation? I'm confused about this, because there already appears to be a steam sdk included with my unreal engine (4.25.4)

  2. Do I need to forward certain ports in my NAT-router, when I want to start a listen-server in my local network? There is no info on this in the official unreal documentation, but I keep reading that this or that person claims, port 7777 (which I know can be configured) should be forwarded on the router.

#

Additional information: I use the advancedsession - plugin

hollow oasis
#

hi, need help with nonseamless travel

#

i have this on my lobby gamemode (from where i travel)

#

and gamemode where i arrives

#

but i cant posses any pawn from my controller

#

doing this on start on gamemode (map where i travel to)

woven sinew
#

anyone know why I can't find my server's session when it's packaged but I can when it's in debug mode

mighty schooner
#

If I run a Multicast event on servers GameState (not server RPC), does it call on all clients as well?

winged badger
#

if you call them on server, yes

mighty schooner
#

This is my scenario:
In my game mode I declared a delegate like this

typedef TDelegate<void(uint8 RemainingPlayers)> FOnAlivePlayersChanged;

I call a custom function on game state called Initialize from the game mode which binds to this delegate with a multicast function like this:

MyGameMode->OnAlivePlayersChanged.BindUObject(this, &MyGameStateBase::Multicast_OnAlivePlayersChanged);

And the multicast function is like this:

void MyGameStateBase::Multicast_OnAlivePlayersChanged_Implementation(uint8 RemainingPlayers)
{
    CurrentRemainingPlayers = RemainingPlayers;
}

For server CurrentRemainingPlayers is correct but for clients its always 0.

meager spade
#

slightly curious why you are doing typedef TDelegate<void(uint8 RemainingPlayers)> FOnAlivePlayersChanged;

mighty schooner
#

Instead of the old DECLARE_DELEGATE_OneParam macro

meager spade
#

YEAH

#

oops caps

#

like you can pass in args

winged badger
#

my question is why don't you just OnRep uint8 RemainingPlayers in GameState

mighty schooner
winged badger
#

this seems more complex then it should be

#

whats your test scenario?

meager spade
#

likely cause your RemainingPlayers is always just 0

#

i don't see how that would be changed

winged badger
#

if you're doing it the moment as players log in

#

it wouldn't work

mighty schooner
winged badger
#

as they would not yet have a replicated GameState Actor to handle the MC

meager spade
#

but he is saying the clients are running the MC

#

but the value is 0

#

meaning the RPC sent a 0 value

winged badger
#

ha, never saw unreal do that

mighty schooner
winged badger
#

with exception where it couldn't net serialize the payload

meager spade
#

PostLogin is way to early

winged badger
#

which is not the case here

meager spade
#

for a MC

winged badger
#

yeah, it is

mighty schooner
#

Ahh then that might be the case.

meager spade
#

just cause server has the GS

#

client only gets it when it reps

mighty schooner
#

So if I change to OnRep workflow will it solve the issue?

meager spade
#

MC can fire before the rep happens

winged badger
#

it will

meager spade
#

no order guarentee

#

certain things should be MC, this is not one of them

mighty schooner
#

Ok. So I'll try the OnRep workflow.

kindred widget
#

Usually when you spawn things and then RPC in the same frame, RPCs will almost ALWAYS reach the client before the replication of the actor does.

sly venture
# thin stratus Should be back online.

yes, your website is online, thanks !
Could you add a redirection from https://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf (which was our main link for your doc, pinned in at least 2 UE4 French discords and in many users favs) to the latest version please ?
The actual link (https://cedric-neukirchen.net/wp-content/uploads/2021/04/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf) would probably change for next versions, as it contains month/year in URL ?

thin stratus
#

Ah, I uploaded it through wordpress this time instead of manually into a folder. I can fix that though

graceful abyss
#

does anyone know anything on my above questions?

harsh ice
#

create advance session and find advance session node is not showing.

graceful abyss
#

I'm specifically asking whether I need to forward any particular ports on my nat router so my listern server session is visible online

sly venture
#

and redirection you just added works fine, thanks man !!

mighty schooner
#

If a variable has not changed since its last replication, will it still be replicated with the same value again or will it be skipped?

thin stratus
graceful abyss
#

ok, thanks for the reply.

#

I configured forwarding the port 7777 (udp and tcp) to the server computer in my network, but it hasn't changed anything unfortunately. my online session is still not listed. I'm using the test-product id 480.

thin stratus
#

Or get your own app id

graceful abyss
#

increasing the max count to 50000 did not change anything either ๐Ÿ˜ฆ

chrome bay
#

Steam will limit you long before that

#

To test properly you really need your own app ID

mighty schooner
graceful abyss
#

i have checked the log of the second client pc though and there were some sessions listed that were discarded due to a different builduniqueid

chrome bay
#

certainly possible if they aren't using the same build

graceful abyss
#

builduniqueid of server and client match, though

chrome bay
#

or

#

It's another UE4 game

#

using that same app ID

#

etc.

thin stratus
#

Yeah you get a lot of results

#

Which then fail to parse

#

That's why 480 is not useful for sessions tests

graceful abyss
#

I know why i have saved myself this part up to the very end.

#

ok, thankyou all for your help

chrome bay
#

Yeah best to just get an AppID it doesn't take too long to setup

#

And you can actually test things like launching through steam etc then, makes distributing builds much easier

meager spade
#

you should have got your steam setup a long time ago if you are near release

#

can take a good month

#

the review process, etc

mighty schooner
#

@winged badger @meager spade Thank you for the help. The replicated workflow works ๐Ÿ™‚

wheat magnet
#

does anyone work with photon in unreal?

jolly siren
#

lol pawns don't get destroyed when a player leaves the game in "4.27" ๐Ÿ›

winged badger
#

well, some peoples will be happy

#

i think 3 of them asked how to do that in the last week

jolly siren
#

haha

winged badger
#

should be easy to fix though

jolly siren
#

yeah, I'm stepping through it now

wheat magnet
#

anyone can guide how to start learn multiplayer in unreal C++ ( not blueprints )

jolly siren
#

I wouldn't go with photon unless you have a specific reason to. Photon is/was bigger with Unity, but Unreal has a much better native network framework

wheat magnet
#

so are you refers to replication in unreal ( native? )

jolly siren
#

yes, unreal's native networking

plush finch
#

Hi there, I need to create an actor. When I call it on a client, it doesn't replicate. My guess is that I need to cast to something server-related, so what should I do?

jolly siren
#

spawn it on the server

plush finch
#

How would I do this?

jolly siren
#

Depends where you are creating it. But just wrap your spawnactor in a if (HasAuthority())

#

And mark the actor to replicate

plush finch
#

I'm using blueprint

#

I have the actor to spawn set as replicate

jolly siren
#

There is a HasAuthority node

plush finch
#

So should I just check for that and that's it?

jolly siren
#

yes, depends on where you are doing this tho

#

what class are you spawning it from?

plush finch
#

A player character (pawn)

kindred widget
#

It's one of those questions where the answer should be simple, but to answer it, you need to know a bunch of other information.

plush finch
#

Ah, I see

#

It doesn't spawn it at all now, I will try and find an authority checkbox on the player pawn

jolly siren
#

what is to the left in the graph?

#

What is calling this?

#

It has to be something that is called on the server

plush finch
jolly siren
#

And I'm guessing you call shoot from input

plush finch
#

Yup

jolly siren
#

Which only gets called on the client

#

So yeah that isn't going to work

plush finch
#

Oh ok

#

So how would I do this?

jolly siren
#

yeah that is only called on the client

#

rpcs

plush finch
#

I'm using advanced sessions btw

jolly siren
#

I would recommend doing some beginner networking tutorials

plush finch
#

Ok, I will do that

wheat magnet
#

the only things that is important in unreal multiplayer is how to RPC events correctly on client and server, can you explain what are the best practices for doing that? @jolly siren

#

because how i know when to use has authority node? and when to multicast events?

jolly siren
#

I would also recommend you doing some beginner networking tutorials

wheat magnet
#

and when to mark a variable as replicated?

plush finch
#

Smart poly has a nice series

#

I'm watching it right now

jolly siren
#

An overview of the essential concepts for writing multiplayer game code in Unreal, in under 25
minutes or your money back.

Sample project: https://github.com/awforsythe/Repsi/
Patreon: https://patreon.com/alexforsythe
Twitter: https://twitter.com/alexforsythe

00:00 - Introduction
01:24 - Net Mode
03:33 - Replication System Basics
05:13 - Acto...

โ–ถ Play video
plush finch
#

I'm watching this one

kindred widget
#

Replication to keep state, Multicast for things that don't need to keep State.

#

Client RPC for specific client interactions, ServerRPC to let a client talk to the server.

wheat magnet
#

can we create fully multiplayer game using only blueprints?

#

or we need C++

#

i mean playing game worldwide

#

not only local multiplayer

jolly siren
#

I wouldn't recommend it

kindred widget
#

Really depends on the game. C++ isn't necessary up to a particular point. But it will limit your ability to control bandwidth and optimize a lot of traffic.

wheat magnet
#

i want to start with realtime multiplayer, since the games runs over internet

#

no ones play on same network

#

why we do that in unreal using blueprint and just basic finding sessions?

plush finch
#

btw guys thanks for the help, really appreciate it

wheat magnet
#

we want to test and run game over internet

jolly siren
#

np roberto

wheat magnet
#

so they said that we need to compile unreal from source to make dedicated server

#

and it take more time to compile the server

kindred widget
#

If you're just making a turn based game. Blueprint can handle it easily. Once you start talking about shooters, or more players than four to six, and considering other major systems and gameplay, Blueprint won't keep up.

jolly siren
#

It depends on the type of game you are making. Listen servers are an option

wheat magnet
#

yes, i want to start with realtime multiplayer games, like racing, shooter etc that we saw in today most popular multiplayer games

kindred widget
#

To be fair. Even the turn based games I have in my head right now would greatly benefit from FastArrays.

wheat magnet
#

i don't want to just learn blueprint with find session nodes with local multiplayer, this doesn't have any advantage

#

multiplayer means multiplayer ( not local multiplayer ), also does the find session, create session, and join session nodes work over internet?

jolly siren
#

yes sessions work over the internet if you use an online subsystem like steam

wheat magnet
#

because the clients and companies want to make multiplayer games that everyone can play at any place

#

is there any alternative solution to test game without compiling the server from source?

jolly siren
#

you don't have to compile from source for listen servers

wheat magnet
#

great, so does listen server also work over internet?

jolly siren
#

yes

wheat magnet
#

from where i can find it's details of listen server

#

i mean is there any tutorials of listen server?

#

so that they test over internet?

#

in tutorials, everyone is making tutorials of local multiplayer, what is advantage of doing this in terms of multiplayer

#

@jolly siren so how steam subsystem works over internet? how players can join and find sessions over internet?

jolly siren
#

Look at ShooterGame, it's fully functional

wheat magnet
#

is there only steam subsystem available? also can you list the all common subsystem are available for unreal?

wheat magnet
jolly siren
#

yes

wheat magnet
#

so it means that shooter game contains everything for learning purpose of listen server, right?

jolly siren
#

yes

wheat magnet
jolly siren
#

yep

wheat magnet
#

is this game example of listen server or dedicated server, also may i ask question that does listen server is easy to implement and reliable or dedicated server

jolly siren
#

It supports both

#

Listen server is easier to setup

#

Dedicated server is more secure for competitive games but has cost

wheat magnet
#

i already have download this project, how i can test over internet, should i need to create game build and share with my friends over internet for test?

jolly siren
#

yes, you will need to package the game and share with friends

wheat magnet
#

thank you so much, i'm creating package, and testing, after i will see the source code how it works

#

i think this will clear all my questions about steam subsystem and listen server testing over internet

jolly siren
#

yeah shootergame is great for learning the basics. Good luck!

plush finch
#

Hey, I'm having some trouble trying to get my damage overlay to work properly now that I have included RPCs.

#

My event, that is not replicated, for creating a damage vignette on the player screen:

#

It prints "fail"

#

And I have a "AnyDamage" event here as well, which automatically runs on the server as far as I am aware

#

This runs the hurt overlay.

#

Any ideas why?

kindred widget
#

@plush finch Is this for like showing floating damage numbers when something is hurt?

plush finch
#

Nope, it is a simple blueprint widget that has a red vignette image

#

It gets added to the viewport if you are damaged

#

but apparently it is not valid

#

All widgets I add are now not valid in the player blueprint

#

except my hud

kindred widget
#

Well. I don't know why your widget is invalid moments after creating it. But you should probably be handling the widget's showing on the client, in an OnRep function for the health.

#

On server AnyDamage gets ran. You lower health. Short time later the server evaluates the health float and realizes it's changed and sends a new value to clients. Then on the client that owns the pawn where this has been lowered, you'd add your widget to screen there.

plush finch
#

Thanks!

#

I'll try work it out from that

candid escarp
#

Hello! I couldn't solve my problem and want to ask again since it really slows down my progress:

Testing a multiplayer game in standalone mode results in a lot of lag - testing in editor windows is fine, can I do something about that? At the end clients connect to a dedicated server via matchmaking and I want to test that locally.

Thanks in advance!

crystal crag
#

@meager spade have you ever used gameplay tags to control movement and animation of the player character?

#

Similar to what this person is doing? https://www.youtube.com/watch?v=n6fxTki84_8

Video 1 out of 5
Goal is to setup a new character with locomotion and general inputs, including new animation pose for greatsword.
The first 5+ minutes are skipable ;)
The entire episode is not very exciting but I decided to do the ground work from zero instead of copy a 3rd person example or any other example character just to have more clean c...

โ–ถ Play video
#

not sure how well that scales in multiplayer

wheat magnet
#

i have only one computer machine for testing game build, how i can test two executables of game build for testing multiplayer over internet

#

because i want to ensure that the game should work over internet

kindred widget
#

With steam, you can't I don't believe. I'm fairly sure you need two PCs and two steam accounts. Not sure about the default subsystem.

winged badger
#

you can launch 2 standalones with same machine and same steam account iirc

hollow oasis
#

Can anyone here help me with travelling?

#

dm me please

tranquil yoke
#

hey guys, i have a weired issue with replication,
-- I spawn a new object on server, there are some replicated varibales in the object, whenever i change them on
server, they get replicated to client, I also save to my data base (another server) ,
-- next time when i log in, my another server sends me data of the last spawned object, then i spawn them on the server, everything works, but if i change the replicated on server, they do get replicated to the clients.

which is pretty strange, i cant seem to figure this out, any one ?

#

but if dont use replication and do multicast, that works

sullen kernel
#

Hey @winged badger we talked about changing armor on a modular character before and how I want to avoid creating too many replicated actors. I made it so the armor isn't an Actor anymore, I just replicate a USkeletalMesh* on the charcater and it changes the mesh. But the armor still needs instance-specific data like Durability that changes during gameplay. Do you think that creating a new UObject* using NewObject() with just the instance data for the armor would work?

#

Making each piece of armor an actor would add a lot more replicated actors to the mix. An armor actor for pants, an armor actor for shirt, gloves, etc. But more generally, my problem is that I'm using data tables for my game items but they also need instance-specific data that changes during gameplay.

tranquil yoke
#

Why not use character for replicating the data and just load right armour on that data ?

sullen kernel
#

The character is replicating USkeletalMesh* pointers, so I can change those and the player will change clothes properly. But I'm just trying to figure out where to put things like armor durability.

#

Everything visually is working great, but I need a place for the armor stats.

#

I have a data table set up for the armor. So I can put general data about the armor there. But something like durability changes during gameplay. So I only have static data about the armor right now.

twin juniper
#

Im trying to set a pitch variables for an aimoffset, but on the clients the head is just spazzing out all over the place. Anyone know what im doing wrong?

tranquil yoke
#

well durabilty seems like a property, that armour should hold by itself, but for that armour needs to be another object, which can hold data.

but you have this as a component, so i would make struct for armour piece, and replicate those,
struct can have :- USkeletalMesh pointer and stats.

you can have now array of that struct and can have multiple armour piece

sullen kernel
#

I see what you are saying, just making it a struct that I replicate. I originally had the Armor as its own Actor with the stats and mesh. But some advised to limit the number of replicating actors that I have because it creates more work for the server.

tranquil yoke
#

@twin juniper multicast event will also get back to you, so if there would be change in values, that will make you go crazy ? i think you should print your local and server values, and see if there is any difference.

and you are setting this on server and then setting on multicast too, which means you setting it for local 3 times, and other two times.

twin juniper
#

it doesnt wokr at all if i dont set it on the multicast ive just been throwing sutuff around until it did something

craggy void
#

@twin juniper I believe pitch is already replicated by default, so you can just use this in the anim blueprint of a replicated player

tranquil yoke
#

@sullen kernel you need to model your data for armour, make a struct for whatever you need in order to make it work. Ideally i would make USkeletalMesh as armour id (int). then use that, because client have data for everything you just need to tell them what to use, which you can do using some id too.

craggy void
#

Most welcome. That'll be way more efficient than spamming multicast RPCs too

timid moss
#

I need help understanding RPCs better if someone can help. So I have a client RPC on my character AShooterCharacter::ClientEmptyRPC and I want to call it in the character's AShooterCharacter::PossessedBy and this is what I have. ```cpp
void AShooterCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);

ClientEmptyRPC();

}
void AShooterCharacter::ClientEmptyRPC_Implementation()
{

}```
Now. Can someone please explain why this screws up my gameplay code? I may just not understand client RPCs well enough but this seems really strange for me especially since it's an empty implementation. I figured I would be safe to do RPCs after PossessedBy since the ownership of the character is established (I think).

#

I should mention if I put the ClientEmptyRPC on the controller.... so ```cpp
void AShooterCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);

ASSPlayerController* MyPlayerController = Cast<ASSPlayerController>(NewController);
MyPlayerController->ClientEmptyRPC();

}```If I do this way, then everything works fine for some reason but I need the RPC on the Character

lost dune
#

I have to know something before starting the Login module of my website, will i be able to connect the players with Epic Online Services using my website database?

timid moss
#

Yeah I've read all that stuff before. I understand UE4's netowrking and ownership stuff. Nothing really explains my problem though

vernal bay
#

Hi can anyone help me at all trying to change another local player to a different character model. Thanks

glacial yacht
#

Controllers are Client exclusive

#

Page 10

lost dune
#

Can i pull users informations from a cloud or web database to EOS (epic online service) features?

quasi tide
#

So you can't make an interface function RPC?

hollow bridge
#

Hi, does the "reliable" property have any meaning when it comes to "run on server" func?

quasi tide
#

Yes. It's not specific to a flow of communication, rather how RPCs are handled.

#

So - I'm handling damage through an interface (I need more info than what the built-in damage function provides). I cast a line out to the target, check if it implements the interface and if it does, I'll then call the server fire/attack event. That then ends up calling the interface which will just call a multicast event in the BP that will replicate everything to the other clients.

This seems awfully convoluted - is this the standard approach with interfaces and networking?

craggy void
#

What extra info do you need that the built-in damage doesn't provide?

#

Generally you want to multicast as little as possible, especially for things that happen often in the game like damage

quasi tide
craggy void
#

That should be in the DamageEvent being passed

#

But if you're multicasting to play things like hit reactions, you're probably better off with replicating a struct with your hit info, and playing the visual effects on the clients in an OnRep

quasi tide
# craggy void That should be in the DamageEvent being passed

I think we're talking about two different things.

When I do the damage event - I do pass everything I need, then I do the damage. It's just a simple health reduction right now and managing state (which will eventually be moved to an OnRep function).

#

I'm doing multicast for the time being to just get things workin' that's all.

craggy void
#

No, I mean that if you listen to the TakeDamage event, there's a FDamageEvent struct being passed as a parameter, which contains things like hit location, damage type, damage amount, etc

quasi tide
#

I'm using BP for a pretty specific reason. AnyDamage is what exists - I see no TakeDamage event

#

And there is no struct that I see in AnyDamage

craggy void
#

Tried using the more specific damage events PointDamage and RadialDamage ?

quasi tide
#

Hmm - point damage is probably what I should be using.

#

Sorry - I was reading about it

craggy void
#

No worries. Hope it helps and make things a lot simpler to implement!

quasi tide
#

Yeah - I can get rid of this interface in particular, I know if the other actor doesn't implement the receive side, it does like nothing.

#

But my question still remains for interface methods. Because they can't be told to be RPC'd directly, is that the general flow? Just have it call a Run on Server event?

craggy void
#

I can't say I use interfaces for anything replication related, but yeah - the interface method could call some Run on Server event (assuming it's being called from the client). Then set some replicated variable server side which has an OnRepNotify to warn clients about changes

#

If the interface is called server side you can skip the RPC altogether of course

quasi tide
#

Right right

tranquil yoke
#

i have a question, how should i update an actor, which is spawned on server and all the events are on the object. so owning client is null.

but object gets updated locally, then i use events on the object itself to update it, i was using the first player as owner, but i just find out, what would happen if player one leaves, then that object is without owner.

Is there an approach to do this kind of RPC to server ?

I am using Rep notified variables on object itself.

silent valley
#

Seems like you're bypassing the built-in ownership logic of Unreal. Can you give more specific example of what this object is?

If you want to send RPC from client to server to control an object not owned by the player, then usually you would put the RPC on the PlayerController or the Pawn as that is guaranteed to be owned by the local client, and pass a pointer to the replicated object.

tranquil yoke
#

i did exactly the same what you mentioned.

#

@silent valley thanks

wheat grail
#

Hey guys, Im testing to connect over the local network with my computer as a listen server and a mobile as a client. After adding the right permission in Android Im able to connect from it. But no luck with iOS so far. It crashes when I attempt to connect. Is there any permission or something else that I could do? There is no relevant info in the crash log and also the debugger crash in a very odd place which does not really add info

upbeat basin
#

Not sure if the channel is correct but I want to know if port can change if we sent multiple travel requests to a map (the ip is same but the port that is trying to connect changes)? Is it possible that this is an attack rather than my error on connection logic?

wheat grail
#

The player enter for a frame or two in the map though, I can see it in the server and also from the phone

chrome bay
craggy void
#

Oh hey @chrome bay, didn't know you were on here. Just read your Better Burst Counter blog; good info! In case you were unaware: the two videos at the bottom of the article seem to be missing. Not that they're required to get the idea

chrome bay
#

Oh yeah I keep forgetting to go back and do that ๐Ÿ˜„

grave notch
#

I can replicate only custom events in blueprints, and it cant return values, but how i supposed to make condition on server then? I want most of my events to be something like "try to do this", so server check everything important and then can successfully complete event or "tell" client that something was wrong so i can react locally to it.

winged badger
#

you assume you can do it, send a server RPC to do it, then server sends an Ack/Fail back to client

#

that causes client to rollback if it gets a fail

meager spade
#

well that is if he is doing prediction

#

simple answer is "ServerCheckSomething" then server does "ClientResponseToCheck" event

#

only way server can respond to a client question

craggy void
#

@chrome bay Since you seem to be more experienced in networking efficiency; with the shootergame base for line traced weapons and hit detection, what would be best for multi-projectile (shotgun) weapons? I hacked it quickly by just looping over the ProcessInstantHit, but with 10 shots that will cause 10 RPCs per call, which I'm sure isn't the best. Storing the result of every linetrace in an array and RPCing that is the easiest way to improve that, or are there better ways with less overhead?

meager spade
#

@craggy void batch them

winged badger
#

pack all hit results in one RPC

meager spade
#

or pack the seed and the first hit

winged badger
#

you can send a const TArray<FHitResult>& just as easily as const FHitResult&

meager spade
#

and reproduce

chrome bay
#

also you probably don't even need to send the full hit result, you rarely need the whole thing

#

just what you hit and where is (usually) enough

craggy void
#

Yeah, I meant the ServerNotifyHit/ServerNotifyMiss RPCs

winged badger
#

you don't need 2 of them

meager spade
#

ShooterGame has 2 tho, and its ok for single line trace weapon

chrome bay
#

ShooterGames' weapon stuff isn't that great tbh

#

It has another reliable for the state machine too which is kind of not really needed

meager spade
#

the notify miss i feel is kinda pointless

chrome bay
#

yeah defo

meager spade
#

if i as a client detect i have not hit anything, why does the server even care?

winged badger
#

they do all kinda of unspeakable things in example codes

#

you might want to display the shot visually

craggy void
#

Hmm, so pack the hit results of a single shot in an array and RPC that. And for replicating displaying missed shots just use the burst counter (with a timer for automatic weapons)?

meager spade
#

long time since i looked at shootergame

chrome bay
#

yeah actually I think that's why they do it IIRC..

meager spade
#

@craggy void dont pack hitresult directly

chrome bay
#

It's been a while ๐Ÿ˜„

meager spade
#

make your own custom smaller set of data

craggy void
#

Yeah, the ServerNotifyMiss is to replicate visual effects

chrome bay
#

hll is based on it but we've changed sooo much

meager spade
#

then again FHitResult might be quite optimized

#

in its Serializer, again, would need to clarify

winged badger
#

@chrome bay what do you do for traces on your projectile manager?

craggy void
#

But good to know, thanks, gives me something to work on

chrome bay
#

One reliable for each actual shot, and one reliable if we hit something that needs to be verified (like character etc.). We have to split it up because the traces are projectiles so not necessarily same-frame hits

winged badger
#

FHitResult is an excellent example of how to write a NetSerialize

meager spade
#

same as Fortnite, one RPC per shot

winged badger
#

really elegantly done

meager spade
#

are you strictly projectile or mix?

chrome bay
#

projectile in all cases now (when i say projectile i mean a stepped trace but you know what i mean)

meager spade
#

or you fake projectile with a hitscan (aka Zlo's system)

grave notch
winged badger
#

he can't do that with WWI game

chrome bay
#

yeah it's just a bit of data rather than actor or anything, but it is "simulated" over several frames

meager spade
#

so you can have like bullet drop and travel time

#

but without needing an actual projectile actor

winged badger
#

so the clients do their own frame by frame trace for their shots and RPC hits to server, server just verifies?

chrome bay
#

yeah travel time was the hard one.. design really had to fight me for that :d

meager spade
#

in fortnite they use mainly hitscan, but the snipers are a projectile actor o_0

#

i wonder why they didn't do it without projectile actor..

chrome bay
#

and we keep a short little buffer of "recent" shots so if they try to send a verify for something wayy in the past we just ignore it

#

(or kick em)

chrome bay
meager spade
#

yeah likely

jagged aurora
#

I have a problem that when I attach an actor to another actor on server on remote client it sends the actor somewhere far for a moment, then returns back and keeps replicating. I am using smooth sync plugin, and I tried disabling it and when attaching of actor to actor happened it started replicating even though the smooth sync component was disabled.

craggy void
#

Is there really no easy out of the box way to detect when the GameState's PlayerArray has been replicated? Everything I've seen so far looks very convoluted and error prone. I've been fiddling with this for my lobby for a day or two and I'm really considering just making my own Array and replicating that with OnRep to use in the UI. It's not like a lobby will have high bandwidth or timing requirements anyway

chrome bay
#

It doesn't actually replicate if you check it out

#

The array is reconstructed locally when player states replicate, the AddPlayerState and RemovePlayerState functions are virtual so you can add an event which you broadcast there

#

Since the player states themselves are always relevant, they can just add themselves to a register locally. Saves the non-negligible overhead of replicating an array

craggy void
#

Yeah, I noticed those. I already gave the AddPlayerState/RemovePlayerState overrides with an event a try, but I guess something else was off somewhere

#

I guess the problem was that the player state was added, but wouldn't be replicated yet. I'll just clean up what I have now and give it another go

chrome bay
#

Ah that can never be the case because the player state is what adds itself to that array

#

So there shouldn't ever be any null entries

#

Don't forget about initialization ordering issues too, the UI will need to query the current state of the array when it's first created - otherwise it won't be up-to-date until another player is added/removed and the event is broadcast.

craggy void
#

The AddPlayerState adds it to the array I would assume? So if I call my event after the Super::AddPlayerState it should be in right?

craggy void
dark edge
#

I'm using framewise traces for projectiles but it's still 1 actor per projectile. My projectiles are all easily visible

chrome bay
#

yeah a world subsystem

#

we just use particles for the visuals, which is good enough as it's all just bullets. It's not as designer-friendly like a projectile is ofc, the implementation has to be fully CPP unlike an actor

dark edge
chrome bay
#

We just spawn them via UGameplayStatics::SpawnEmitterAtLocation() when initializing the bullet/projectile

#

The data has a TWeakObjectPtr to the UWorld, the "simulator" class etc.

eternal briar
#

In my multiplayer project, I have an actor A, whose owner is B, and B's owner is player controller. When I call GetOwner in blueprints in actor A, will it give me B or player controller?

winged badger
#

it will give you direct owner

#

doesn't matter if its multiplayer or not

eternal briar
#

so it will give me B, got it thanks!

drowsy arch
#

does anyone know how i could implement a rocket jump mechanic?

#

would it have to be through the character movement component?

quasi tide
#

@craggy void Thanks for highlighting about the more specific damage events (I only ever really bothered typing in Any Damage to be honest) - I switched everything over, still works, and it made me go ahead and switch to the OnRep setup like I was planning to do, just sooner.

drowsy arch
#

i tried that but it only did on the server not for the clients

craggy void
drowsy arch
#

yeah i did it was the same

#

its confusing me.

#

because its replicating the server to the client but when i try to run it on the client it doesn't work

craggy void
#

You probably need to call it on the server. I'll see if I can hook it up quick

drowsy arch
#

is there a way to force it to run on the server

craggy void
#

That works for me

quasi tide
#

I thought stuff like that was unreliable?

#

Maybe I misunderstood what someone was telling me

craggy void
craggy void
quasi tide
#

The launching

craggy void
#

I can imagine that lag could create some issues with syncing the movement

eternal canyon
craggy void
#

Unless it's a listen server

meager spade
#

thats still a locally controlled pawn

#

controller/pawn w/e

#

and you still don't need HasAuthority on the input.

#

a server calling a Run on server event will just execute it locally

#

like a normal function

craggy void
#

Ah like that, got it

meager spade
#

this is fine ๐Ÿ™‚

craggy void
#

That's what you get from looking at ShooterGame too long with it's StartFire() { if (no authority) { ServerStartFire(); } // Do shooting logic} and ServerStartFire() { StartFire(); } chains I guess ๐Ÿ˜…

drowsy arch
#

thank you

eternal briar
#

Since sets and maps cannot be replicated, can they be sent using RPCs?

lucid vault
#

Is there some sort of global event broadcast system that I can use for broadcasting things, such as footsteps, so that other characters can be aware of those footsteps? I can't use delegates, as I don't want chars to have to re-bind to every character that joins the game

meager spade
#

@eternal briar no

#

you will have to bind at some point somewhere.

#

for footsteps we just use Anim Notifies

#

they fire on every client when the animation plays.

#

@lucid vault ^

lucid vault
#

I have that system set up so that my character BP is notified

#

When my character runs, I want each footstep to notify other characters so that they can play a camera shake

#

However, I don't the running character to directly modify nearby character's cameras. That seems pretty anti pattern to me. What if, perhaps, there are two characters running, both trying to modify another characters camera at the same time

#

I would prefer if there was a system in which I could broadcast the footstep from one character, and the global footstep event could be listened to by other characters

twin juniper
#

Im trying to add an item pickup system to my game. I am calling the interact interface function locally so i can display the loot notification on just that player and then im calling the set visibility on the server, but it doesnt seem to set the visibility when the clients do it. Does anyone know what I'm doing wrong?

gilded vapor
cold blade
#

hello, can anyone help me with my Problem? My Problem is that i made a dedicated server (from source) and my friends cannot connect to it. I made the Port Forwarding (with my IPv4 Adresse and Port 7777 which my server is also using) and i also made a firewall input rule for that Port. I can join at my machine lokal. But if my friend tries to join using my IP at the command tab nothings happens and i saw nothing happening at the log.

zinc acorn
#

so like i made something where u can set the players color to whatever you want, everything works as far as im concerned and it "technically" replicates properly

#

the issue is is that the color does not show up for a new client apon joining, however if i press a button to call it again it works and the color shows up for the client(s)

fossil spoke
#

Are you using a RepNotify property for the Color and setting whatever is visualizing the Color in the RepNotify function?

elder crypt
#

Hey! I was having trouble using seamless travel when trying to reopen a level using the ServerTravel console command. When I have seamless travel disabled the players will always spawn in. However, when using seamless travel the players sometimes don't spawn in (all of them)

#

I was hoping to get seamless travel to work because to my understanding using it allows players to not need to reconnect to the server

#

I've been having trouble finding documentation so if anyone can point me in the right direction I'd really appreciate it :)

#

I'm not sure if this a bug with just the PIE ^ but here's my settings for it:

fossil spoke
#

What do you mean they dont "spawn in"?

#

How are you spawning them, what does this mean exactly for your game.

#

The Image you posted has nothing to do with Seamless Travel nor Spawning.

elder crypt
#

Oop you're right I should've been more clear. I'm spawning them using the default playerstart. I'll record a short video real quick and elaborate more

fossil spoke
#

Thats where your spawning them, not how.

#

Are you simply setting the DefaultPawnClass in the GameMode and letting it spawn that automatically?

elder crypt
#

Yes, I'm not overriding anything having to do with spawning them in

fossil spoke
#

So your traveling to the same level?

#

Or a different one?

elder crypt
#

It's the same one. When using seamless travel will it not 'recreate' the level?

#

I'm not sure how to phrase that

#

I was using the same level for testing it out

fossil spoke
#

If your using ServerTravel it will yes.

elder crypt
#

It will recreate the level?

fossil spoke
#

It restarts it

#

Your not doing anything on PostLogin in the GameMode?

#

This does not get called for traveling clients for Seamless Travel.

elder crypt
#

The only thing I'm doing on postlogin is setting the player's name in the player state

#

Other than that I'm not

fossil spoke
#

How do you know they arent being spawned in correctly?

elder crypt
fossil spoke
#

Oh

elder crypt
#

I press the F key on my keyboard and it sends a server RCP up to the game mode telling it's ready to restart

fossil spoke
#

Seamless Travel doesnt work in PIE

elder crypt
#

oh shoot

#

Is this something I should just roll with and wait until I push it out to AWS to test?

fossil spoke
#

You can test it locally if you run the dedicated server locally and connect to it locally etc

#

But has to be outside of the Editor

elder crypt
#

That's good though- I thought I had a misunderstanding of the framework

fossil spoke
#

You can typically trust Seamless Travel to work though.

elder crypt
#

Okay! I appreciate the clarification, thank yu

#

you*

zinc acorn
boreal wadi
#

Hello. Quick question about dedicated servers. Say I want to spin up my own servers for testing using my other PC (i6700k 16gb ram) how would I go about creating options for different game modes. Like if ppl just wanted to play Deathmatch on a map, or Bomb on another, how would I make that happen? Is it possible to have some form of UMG widget on my server builds# that allows me to set the settings for each server I instantiate? How many servers can I run at once for a 5v5 competitive shooter?

marble gazelle
vivid seal
#

when an object is first replicated to a client, are all of its replicated variables immediately replicated as well? i have a boolean that OnRep initializes the object for the client, and want to know if the other variables will be set when this OnRep fires or not

small tartan
#

adding side question to discussion above.. so 'run as client' option does not run dedicated server in background?

digital talon
chrome bay
#

Check the logs

#

Most likely, client doesn't own that actor

winged badger
#

well, since its BeginPlay

#

at least some instances won't be owned by the client with more then 1 client

elder crypt
#

I had a quick question about using seamless travel. When I open a new level using seamless travel what exactly moves over? Is it just the pawn/player state?

Lets say in one level I have a pawn with GameMode A with a player controller A. When I move levels, there's a different GameMode, B, with player controller B. Does the pawn use this new player controller?

Thanks :)

chrome bay
#

Pawns don't come accross

#

No actor is actually transferred, the engine spawns new ones and gives you a chance to copy properties between them before destroying the old ones.

#

By default only the PlayerState has any transfer functionality

winged badger
#

you can persist them

elder crypt
#

Ah, that's perfect actually

winged badger
#

by overriding the GetSeamlessTravelActorList in PlayerController

#

to include its own Pawn

elder crypt
#

I'm trying to create a lobby system and was worried I had to spawn the pawns in the lobby before travelling to a new level

#

So the only thing that persists would be the player state?

winged badger
#

you don't, but you might end up doing it anyways

#

i know i did

chrome bay
#

Does it actually change the outer of the pawn to be the new level?

winged badger
#

spawned the pawns so player can see the pawn while getting setup

#

@chrome bay i think the PC remains as its link

chrome bay
#

interesting...

#

I've never done it with pawns

winged badger
#

its been 3 years since i used persising the Pawns, so don't recall

#

@elder crypt out flow is pretty much

#

i spawn preview pawns (not gameplay class) in lobby

#

players get setup, the lobby and combat PS share a base that has all the info transferred between levels

#

lobby and combat don't have the same GM, GS, PS, Controller, HUD or Pawn classes

chrome bay
#

@twin juniper Client has to own the actor, simple as that

elder crypt
#

That clears a lot up, thanks!

winged badger
#

base PS implements copy properties to copy all its data from old PS

elder crypt
#

It's hard fumbling through this for the first time because I have a lot of trouble finding documentation

winged badger
#

then when i land on combat level i pull the data from it to instantiate the Pawn

#

or better phrased, configure the Pawn, as i don't have different gameplay classes for different hero classes, all composition

#

we do persist one Actor, MisisonSetupActor both ways lobby<=>combat

#

it keeps all the mission settings and results

#

@elder crypt i also suggest configuring the travel level to have the same GM as departing (lobby) level

elder crypt
#

What would be the advantage of that?

chrome bay
#

Either spawn it on the Server with a valid player as the "Owner", or call SetOwner(SomePlayer) on the Server.

winged badger
#

thats avoiding disadvangates of not doing it

chrome bay
#

Spawning it is really the only reliable option if you want to call a server RPC on begin play

winged badger
#

as the Travel level will execute GetSeamlessTravelActor list with its own GM

#

so if you don't set it, and are using an override of that function

elder crypt
winged badger
#

your Actors won't survive transfer from Travel to Combat

elder crypt
#

oop

#

It should be the second link in the pinned channel

#

And thank you!

#

I'll look into implementing something like that- I really appreciate it. I'm doing a small-scale golf game

#

try that

#

You'll want to read all of it but the Remote Procedure Calls chapter (page 59) goes in depth on what you're dealing with

thin stratus
#

Chances of someone trying to access that compendium the second I restart the Droplet to resize it due to out of RAM issues..... too damn high apparently.

thin stratus
#

Need to update that eventually to have a proper image or so

chrome bay
#

While that is horrible it should work most of the time I guess ๐Ÿ˜„

#

The problem you've got with actors placed in levels is they almost certainly will begin play before player pawns are even spawned.

#

This matters a lot more in multiplayer

#

You then have the issue whereby if the client doesn't receive both the actor, their pawn and the change in ownership before that timer expires, they also won't call the RPC - so there's an inherent replication race condition there too

winged badger
#

that will set the owner locally

#

on each machine

#

so, no, it won't work

elder crypt
#

^ Each player, including the server, is running their own instance of the game independently

chrome bay
#

Oh yeah, didn't even see that

elder crypt
#

That's the tough part and necessity of replication- to keep things in sync between these instances

chrome bay
#

To get MP stable/reliable you need to build in a lot of redundancy to deal with stuff like this, and all the "what if" scenarios

#

Hard to know/teach those though.. just comes with exp

elder crypt
#

What worked really well for me was to sit down and write everything down in Cedric's network compendium in a journal

chrome bay
#

If it's a Blueprint placed in the world it's not something you can do reliably in that one Blueprint alone

#

Best way to handle this is spawn the actor on the Server, with the correct owner

elder crypt
#

What's the timer being used for?

winged badger
#

that is also a limitation of blueprints

#

which are somewhat inadequate for networking

#

proper solution is for server to assign owner to preplaced actor

#

then OnRep_Owner in that actor (checking if owner is locally controller) would be the first time you can send a RPC

elder crypt
#

You should do that in the gamemode then

#

It's only on the server so you don't really need to worry too much about replication for that class specifically

winged badger
#

@twin juniper i generally advise people not to jump into multiplayer before they are very comfortable with unreal in general

#

usually just leads to frustration to the point of quitting unreal completely

elder crypt
#

I agree. Check my logs and you can see that the first thing I tried in Unreal was networking

#

It didn't end well and it took me a few years until I approached it again

#

Reading into the singleplayer framework and getting a grasp of that helps a long way:)

winged badger
#

i can tell from your code snippets that you are not even close to fully understanding the game flow

#

๐Ÿ˜ฆ

elder crypt
#

Something I was trying to conceptualize was how to determine when every player was loaded into the new level. There doesn't seem to be an easy event out of the box for it. I kinda just checked if the NumTravellingPlayers was 0. Is that how you approached it?

winged badger
#

@elder crypt it gets more interesting when you have a shitton of stuff to do before you allow BeginPlay to be called

elder crypt
#

ahah, I can imagine

winged badger
#

we spawn a procedurally created level -30k or so actors

#

on each machine separately, then lie to the engine in order to network them after the fact

elder crypt
#

I'm assuming BeginPlay is called regardless of whether or not the MatchState is set to in progress < for the pawns

#

goodness that's a lot. What game are you making?

winged badger
#

linked in private

#

to top if off, most of the levels are destructable, and we allow join in progress

#

client has no business determining win/loss for server to verify

#

server on its own, tracks win/loss conditions

#

from the GameMode

#

then just notifies the client the match is done

elder crypt
#

think of the client as just a keyboard/mouse

fierce grove
#

Hey guys any resources on how to have in game notifications for steam invites ?

winged badger
#

bind to a callback from steam API, shove the handler on the Game Thread

#

and display a widget for it

fierce grove
#

Via steam sockets ?

haughty kernel
chrome bay
#

Replicated a separate skeletal mesh variable and change the mesh via OnRep

#

ez

haughty kernel
#

Thanks, have you tested it before ?

chrome bay
#

Don't need to test, I know it'll work

#

Updated the post with my answer

haughty kernel
#

Thanks ๐Ÿ™‚

jolly crag
#

This exist with particles and staticmeshs also btw

#

Same issue

chrome bay
#

StaticMeshComponent has the mesh replicated so so long as the component is replicated it should work fine, but it's still a less-optimal way of doing it

jolly crag
#

๐Ÿ˜‰ try it in a MP game

chrome bay
#

USceneComponent has a bunch of built-in replicated properties too, and when you enable replication on the characters' USkeletalMeshComponent it breaks CMC networking too

#

It works fine, used it loads of times

#

You really should avoid replicating USceneComponent derivatives if you can

jolly crag
#

Ok, not arguing it...i know i experienced the same issue just 3 weeks ago in 4.26 with staticmeshes not replicating on runtime to clients

#

When you change them during play...

haughty kernel
chrome bay
#

Rememeber that both the actor and the component has to be replicated

#

(And you should only call SetStaticMesh on server ofc)

#

I'm in 4.25 atm but I don't think they removed it from 4.26

jolly crag
#

Same happened to particles changed during play. And yeah im aware of component replication and actor replication. Not new to ue4

chrome bay
#

That's in 4.25

jolly crag
#

The solution to use onrep replication function to do it was perfect solution for that headache

chrome bay
#

Yeah that's the way to do it

jolly crag
#

I reported it to epic but they never got back to me then someone replied it was a known issue

haughty kernel
#

thanks both of you !

jolly crag
#

Now I think of it the onrep function is probably the best way to do it. Because even if it was replicated anyone that joins after the mesh was changed ain't going to see the correct mesh

#

Unless you're doing it through the onrep function

elder crypt
#

Is there a way to not have the player controller persist when using ServerTravel?

dark edge
#

Is there a way to automagically start a session at startup or do I have to do it at the splash screen/main menu transition?

elder crypt
#

Oh it seems I might be able to use OnSwapPlayerController somehow

twin juniper
#

Hi guys, often while testing multiplayer I get a black screen on the client. The only thing that fixes it is rebooting my computer. Has anybody seen anything like this before or know what may be causing it? Thanks in advance for any info, you'd be saving me a lot of time.

chrome bay
#

being kicked to an empty entry/transition map perhaps? Would have to check logs

boreal wadi
chrome bay
#

can't get cheaper than listen servers

#

It pays to try and support listen and dedicated the best you can, even if you don't ship with it

low helm
marble gazelle
twin juniper
low helm
#

a blank screen can mean you're not in a level, or you dont have a possessed pawn

chrome bay
#

Most likely you've had a network error and you haven't handled it to send you back to the main menu

twin juniper
#

yes, I believe that could be it. Will continue to investigate.

#

I'm not using a menu, just a sandbox project to build a functional ability system

#

pretty bare bones

chrome bay
#

The engine will kick you back to the entry map on error IIRC by default

#

If you don't have one set it probably sends you to the blank "Untitled" map

bitter oriole
#

It will

twin juniper
#

On looking again, I see this error: "LogNet: ReplicationDriverClass is null! Not using ReplicationDriver."

#

Will restart my computer and try again and see if this error repeats. Thanks again.

quasi tide
#

Real talk - thanks to all of you Networking vets who stick around and answer the same questions time and time again. Ya'll the real MVPs.

dark edge
#

Is there a trick to automagically launch as listen?

#

Basically I want it to be seamless, you hit the main menu as a listen server

meager spade
#

add the ?listen to the launch params or have a empty default map that opens MainMenu with the ?listen param

elder crypt
#

When using seamless travel with two different playercontrollers between levels the player doesn't seem to want to spawn in the new level. Does anyone know why this may be? I'm spawning them automatically through the DefaultPawnClass in the GameModes

#

SwapPlayerControllers() looks like it's doing what it should do but the player seems to not want to spawn

vague fractal
#

Does it make any sense to make the method MoveForward(float Value)(and similar) to an RPC in case that the code looks like this ?

void UPlayerMovementComponent::MoveForward(float Value)
{
    if(Value != 0.f)
    {
        M_OwningPlayer->AddMovementInput(M_OwningPlayer->GetActorForwardVector(), Value);
    }
}

Where M_OwningPlayer is an ACharacter ?

winged badger
#

CMC does that for you

vague fractal
#

Alrighty

waxen nexus
#

Hello everyone, I'm having a few issues working in Source with GameLift enabled. They are:

  • *Server.Target.cs does not populate to */Source folder in the solution explorer after generating project files
  • After manually adding *Server.Target.cs, building with the Development_Server x64 build config (after rebuilding the editor) builds as "Invalid Win32" instead, and "Development_Server" is not on the list in the config manager
  • as a result of one or both of these I am unable to build my server application
fierce grove
meager spade
#

that is what it is for

fierce grove
#

damn ok I have to expose this in Blueprint then

winged badger
#

that kind of PC access sounds fishy to me

merry hemlock
#

Is it just -?listen to the shortcut?

shy kelp
#

Will the "find sessions" node always fail within the editor?

sullen kernel
#

If a timer needs to run on the server for game logic, how should it be replicated back to client to update UI?

#

If client starts its own local timer, it won't be in sync with the timer on the server so what the UI is showing could be incorrect.

#

I want the UI to show a progress bar that should be filled up 100% when the timer is fired.

#

For now I am going to have the server start the timer, send a client RPC telling the client to start its local timer. So at least if its wrong, it will finish sooner than expected for the client. But if there's a better way to handle this sorta thing, please let me know. ๐Ÿ™‚

merry hemlock
#

How difficult would it be to make a simple android client that uses a widget interface and then trigger events from that onto a full-fledged PC client - I've got the listen server working

shy kelp
#

uh, this is an in built node lmao

#

i dont have the advanced session plugin rn i dont think??

shy kelp
#

Yeah I checked, it's built in, also I fixed my erro

merry hemlock
#

I'm confused AF here - I am starting a listen server but how I open two instances of the same exe - it keeps closing one and opening a new one, so I can't open one, execute a console command to ?Listen and then open the local IP to join it - I asked earlier but no one seemed to know

shy kelp
merry hemlock
#

ugh - it's a 30 gig project

shy kelp
#

Don't use clone either

shy kelp
meager spade
#

i can open 2 copies of the game..

merry hemlock
#

I can on my computer here but on a machine with VR it doesn't

meager spade
#

seems a limitation with the VR

merry hemlock
#

that's why I was asking about shortcut launch options

#

like having the windows shortcut could I pass in a console command there?

shy kelp
meager spade
#

it is normal ๐Ÿ˜„

shy kelp
#

Bruh

#

Welp

meager spade
#

make a new project, cook, run the exe twice

shy kelp
#

Doesn't matter regardless

merry hemlock
#

like can I pass anything parameter in there?

meager spade
#

to do what?

shy kelp
#

Oh after cooking, I mean just for testing

meager spade
#

well you should cook for testing

shy kelp
#

I don't do that, waste of time for me ๐Ÿคท

meager spade
#

Editor testing != cooked testing

shy kelp
#

Ik it's good practice though

#

I just use the standalone feature by launching it from files

meager spade
#

@merry hemlock i mean what do you want to pass in? to do what?

#

@shy kelp our build server just does the builds periodically, its a time saver ๐Ÿ˜„

shy kelp
#

Ah

#

I'm too lazy for that hehe

merry hemlock
#

I'm new to multiplayer though I read the replication compendium 2 years ago - I am just checking down this rabbit hole superfast - Because it may not even work so I don't want to have to spend that much time double checking

#

but I just want to be able to open up a listen server and a single other client - it's mainly to use the second client as an interface for the instructor in a VR training program

#

and basically my begin play just as a widget to the viewport only if you are not the server (the server is the VR player in this case)

#

before I can begin to iterate anything, I first have to have it running as a package to build because the way the editor handles VR previews I can't do it any other way

#

@meager spade Now that I have this package billed I was looking for a way to run some of these commands - unable to do that on my local machine here, but when I remote into my other machine that actually has the VR running on it (it's many miles away in another office) - when I tried to open up the EXE, and open up the main level with the ?Listen - When I tried to open up the exceed again so I can use the open IP command it just closes the other one it opens up a new instance

tawny parcel
#

Is the replication graph on by default now for the grid based culling? Even for blueprint projects - or is it manually turned on

#

@twin juniper In the game mode you can add the players to an array as they join, do the clients need the info or just the server?

#

In the game state I believe there is the players array, which tracks player controllers to the server as well

meager spade
#

Get GameState -> Get Player Array

#

if you want to avoid the local player, you can get the controller from the playerstate and not add it if its LocallyControlled.

#

@merry hemlock i have no idea, why you trying to open them on the same machine tho?

#

i mean wouldn't the "instructor" be on another machine?

merry hemlock
#

No, then I have to make fire depts buy more computers

#

again, there is only a widget on it so it shouldn't be too intense, and these are beefy machines

#

goddamnit why does the editor keep opening up and closing another

#

It's VR being an asshole again

meager spade
#

there is always a player

#

even in main menuy

merry hemlock
#

i swear to god I've spent literally over 2,000 hours trying to get a instructor interview working in VR in the unreal engine - using a stupid 2DRender target assigned to a 3dwidget via scene-cap component, and setting the spectatorscreen texture to that and interpolating mouse movement to the widget interaction component - then an unreal web server and making an entire list of commands via html/CSS jscript bullshit, before finding out that the plugin has massive GC memory leaks, then I spent another 500 trying get the spectator screen plugin to work, only to find out that it interrupts critical input and breaks my game --- now I see light at the end of the tunnel using a multiplayer client, an a crude test indicates it COULD ACTUALLY WORK, and now I can't open up another instance of the game on m VR machine so there is no way to confirm it, I will literally have to sink in a day's work learning multiplayer concepts only to find out, I'm sure, that VR is different in Unreal and fuck me for trying to do it .

meager spade
#

well PlayerArray is PlayerStates

#

so your == there will not work.

#

and construct is going to be way to early

#

if the widget comes up instantly

#

put a 1 second delay

#

pull the blue node from the foreach, get owner and then compare

#

Owner of playerstate is the controller.

#

No

#

Before the foreach

#

And you equal is wrong also

#

Read what I said

meager spade
#

Just remove the branch

#

Its wrong

#

Go simple first

#

?

elder crypt
#

I was wondering if anyone knew of a good course/resource to get a grasp of UE4 with AWS's Gamelift. I watched through and followed along with Flopperam's YT course but I'm having trouble finding other resources to learn from. Thanks :)

meager spade
#

I told you the way to get players. So don't say I don't know what I am saying. I have been using ue4 professionally for 3 years on multiplayer games. @twin juniper

#

For all I know the rest of your logic/setup could be wrong. You asked how get the players. I told you. If it's not working then try debugging.

shy kelp
#

@meager spade does ue4 support P2P or is it client server only

#

Huh, all players have a player index?

meager spade
#

Its sever client only

#

Either listen server or dedicated server

#

People have done p2p but it's not default in ue4

shy kelp
#

damn

copper portal
#

hello im just up at 3am to say multiplayer is such a headache. โœจ

bitter oriole
#

No shit

#

There's a reason most people avoid it ๐Ÿ˜›

chrome bay
#

@vast forum check the logs, do you see anything like "No Owning Connection for ###"

#

And presumably myThing is an Actor / Actor Component class?

vast forum
#

Yeah, so I did notice one log which I was quite worried about. Let me pull it up..

#

failed to send ping over the network, reason: The connection has been aborted.

#

The actual structure is:
AMyActor which contains some internal UMyObject.

UMyObject needs to run some logic client-side, then send a notification to the server, so it can authoritatively do some things.

So I'm calling myObject->GetMyActor()->CallServerRPC().

For maximum safety, I've actually gotten GetMyActor into a variable, so I can fully check that its not nullptr in the debugger before calling CallServerRPC

#

The RPC itself is:
UFUNCTION(Server, WithValidation, Reliable, BlueprintCallable, BlueprintAuthorityOnly)

#

So my understanding is that after my breakpoint on myObject->GetMyActor()->CallServerRPC(), I will next hit a breakpoint in CallServerRPC_Implementation, but thats the part that never happens.

The whole structure of CallServerRPC is not something I've written myself -I'm only attempting to call it.

chrome bay
#

Yeah that's fine, the CallServerRPC() body is implemented by UHT so you don't need to do anything

#

But _Implementation not being called means it's never reaching the server

#

So the first thing to be sure of is that the Actor is owned by the clients' player controller, either directly or through it's pawn or something it already owns.

#

If it's not you won't be able to call those RPCs

#

Also, what do you have in the CallServerRPC_Validate portion?

#

If that returns false, it will kick the client and the _Implementation will never be executed either.

vast forum
#

Yeah I'm aware of the validation trap. Its just returning true (not sure why it needs validation in that case, but maybe future-proofing).

chrome bay
#

If you don't need it you can remove it, they made it optional now (just remove WithValidation from the UFUNCTION)

vast forum
#

So the first thing to be sure of is that the Actor is owned by the clients' player controller, either directly or through it's pawn or something it already owns.

This is something I definitely need to look into, and would probably explain it.

chrome bay
#

Yeah that's the most likely scenario

#

To call a ServerRPC the player has to be the net owner of the actor, which you can set by calling SetOwner(SomePlayer) on the Server

vast forum
#

Ok. All good things to google, thank you.

How does that work in reference to shared actors?

chrome bay
#

TL;DR it doesn't, clients can't call RPC's on an actor they don't own and that's by design

#

To get around it, you usually have to route the RPC through something they do own - e.g. a controller

#

If you have a lot of in-world objects that clients need to call RPCs on, it can be beneficial to setup an interaction system to handle that more generally

vast forum
#

I see.

Looks like I need to do some more investigation internally then. Thank you very much Jambax.