#multiplayer

1 messages · Page 652 of 1

slow hornet
#

SpatialOS? No I didn't , i need to check that out then

#
LogLinker: Warning: Failed to load '/Game/FirstPersonCPP/Maps/UEDPIE_0_Map1': Can't find file.
LogNetPackageMap: Warning: UPackageMapClient::InternalLoadObject: Unable to resolve default guid from client: PathName: /Game/FirstPersonCPP/Maps/UEDPIE_0_Map1, ObjOuter: NULL 
LogNetPlayerMovement: Warning: ClientAdjustPosition_Implementation could not resolve the new relative movement base actor, ignoring server correction! Client currently at world location X=-248.518 Y=1589.281 Z=311.647 on base

I guess its not possible to have two levels loaded on the server =/

thin stratus
#

Yeah the engine is build around one server, one world, one persistent level

#

Spatial OS costs money and i think they basically replace how the servers work but keeping ue4s replication logic. But not sure. Never used it cause €€€€€

hallow summit
#

can someone help me with how to spectate random player on death in blueprints?

glad otter
#

guys how can I resolve this error when trying to host, I'm getting a headache, I think all other problems are because of this :LogOnlineSession: Warning: OSS: No game present to join for session (GameSession)

#

here is my host function:void UPuzzlePlatformsGameInstance::Host() { if(m_MainMenu) m_MainMenu->RemoveWidget(); UWorld* World{ GetWorld() }; if (World) World->ServerTravel("/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap?listen"); }

upbeat estuary
#

iirc you don't need to have a session open to join

#

so I don't think this is your issue

#

I have this warning too but connecting works just fine

glad otter
#

y ik it works fine but there is another error so I thought it may be because of this

#

LogNavigation: Warning: NavData RegistrationFailed_DataPendingKill.

#

and there is another weird behavior that the camera is sometimes focused on the Player's butt xd and sometimes not

#

I'm rlly confused about these behviors

slow hornet
slow hornet
#

Thanks for your answer. so you are saying that what they might have is: several servers, where a specific server is responsible for each tile of the big map, and in order to go from tile 1 to tile 2 , the player would need to do a seamless travel (disconnecting from a server and connecting to a new one, where the new level is loaded) ?

wide portal
#

Should ActorComponents created on the server automatically be replicated to clients as long as their owning actor is set to replicate?

nocturne iron
#

For some reason the actor is not destroyed, even tho DestroyActor is called (checked with breakpoints). The BP_Andre_DrainShield actor has Replicates set as true? Also. spawning works just fine...

summer tide
woven sinew
#

anyone use the dedicated client config ?

red salmon
#

Hi everyone! I have recently done a username system in which the player pawn gets the usernamr variable then it sets it's own widget component to display his name. The problem is that if somebody joins after it does that it fails to display the other players name that have already done their display. I have tried repnotifies and they didnt work any ideas?

stone vault
modern cipher
iron spruce
#

hey guys, how can i replicate a variable from the client to the server? i know i can do some weird event stuff but is there an easy way to keep a variable value consistent across all users?

stone vault
#

Multicasting.

iron spruce
#

Buy how can i multicast a variavle?

stone vault
#

Those should guide you

iron spruce
#

Thx!

stone vault
#

Yeah, make sure you run the replicated variable from the server, not the client

hallow summit
#

Does anybody know how to spectate a random player when you die in blueprints?

stone vault
#

I would just have a special character class that spawns via the server (GameState or whatever) and then have that player possess it and have it set to Only Owner See on the mesh in the character bp.

#

So make SpectatorCharacter bp, in the left panel select the mesh, in right panel search 'owner' and you'll find a check box for 'only owner see', select that.

#

If you just want it to follow around a random player you can make it an actor with a camera instead and have the player controller possess that

#

and probably parent it to the character being followed or something

hallow summit
stone vault
#

So in whatever you have that spawns the camera, go to that function. Do a... I think it's Get All Players (I believe you can call this in the Game Instance or Game State) and then get the index of each one. Do a random integer in range, with the range being those indexes, and then use that random number for get by index.

#

And assign it that way

#

You can also go in Game Mode/Game Instance (I always forget which) and do AtPostLogin event, with an input if NewPlayer, > add to player array

#

and pull from that array with a random in range

#

That'd probably be more efficient on resources

hallow summit
#

Ok that makes sense, but how would I then make it so it doesn’t select a player that’s already dead

stone vault
#

Add a check for IsDead and have each player character have that as a bool

#

have it switch to IsDead when they die

summer tide
#

If I attach the player to a another character. Can I control the second character using the player? Would I need to set owner for replication?

stone vault
#

You can only have one person possess a character at a time from what I'm aware.

#

you can't replicate player controllers

summer tide
#

When you posses you give control to the second character. But in my case, I still want control but only i'm attaching the player to the second char.

stone vault
#

You don't want the spectator to possess the player they're spectating

#

That's why you'd probably need an actor or something if you want them to possess anything, or you could possibly set it up so they can view from that players camera. I'd have to look into it more.

summer tide
#

Not that. What I'm trying to do. I have a player and a horse character. I want to attach to the horse.

stone vault
#

Ohhh

#

Well then just make it a component

#

to the player character

summer tide
#

Ok I have a comp

stone vault
#

I mean you could probably do it just like armor

summer tide
stone vault
#

I don't see why it'd matter if it was third person. Probably easier, actually.

#

So what you'd want to do is add the horse component to the character, and set the player movement speed to x.

#

So say your mount horse button is P. Do a custom event, input key of P. From there, set player movement to x, whatever speed you want.

#

And Add Horse Component to character

#

Have a bool on the character called IsRiding that you set when they mount. when player hits P again, check if IsRiding.

#

If so, then remove horse component from character and set player speed back to base.

#

You could probably elaborate, but that's the gist of it.

summer tide
#

The way I did it. It works in single player. I was trying to control the movement of the horse from the player. Since I only attached the player to the horse but the player still has control.

stone vault
#

I wouldn't attach the player to the horse, I'd do it the other way around.

#

Make the horse a component of the character.

#

That way it will replicate the player character's replication status.

#

So you don't need to worry about all that.

#

All component follow the replication attributes of the parent (character) unless directly specified otherwise.

#

Yeah, but I feel like it's just easier to attach the horse in a multiplayer situation. Less worrying over replication.

#

But then I like to be lazy where I can. :p

#

Back when I used to play WoW, you'd sometimes see issues with mount replication and you'd have squatting players flying mid-air around the map. It was great.

#

I know. I was just commenting.

stone vault
#

Pfft

summer tide
#

So I added a socket to player's pelvis.

#

I attached the horse to that socketg

stone vault
#

I mean, it looks funny at least

#

You gotta adjust it when you add it

summer tide
#

But if I rotate the socket, the horse's orientation won't change

stone vault
#

Hrm

summer tide
#

Would I be able to use the same animbp. After mount, the player is in ride idle anim.

#

If I moveForward, i want the player with the horse to move

stone vault
#

The components should move together when they're socketed

slow hornet
#

so for the multiplayer with multiple maps, they would need different servers for each persistent level, correct?

stone vault
#

Here we show you how you can attach a static mesh to a socket that we made in the last video, a very common process that allows you to attach items such as weapons to a characters hand's or other parts of their skeleton.

♥ Subscribe for new episodes weekly! http://bit.ly/1RWCVIN

♥ Don't forget you can help support the channel on Patreon! https...

▶ Play video
stone vault
#

Unless you plan to have multiple servers up, you need to either load the map in chunks depending on something like net cull or you need to use some form of persistent level.

summer tide
stone vault
#

Yeah, that's totally doable. Just make sure you set your replications correctly.

summer tide
#

ok that's what I want to know/

stone vault
#

I would just set the horse as NetUseOwnerRelevancy

summer tide
#

Hmm could it be done via blueprint I wonder

stone vault
#

Can what?

summer tide
#

It's only a checkbox

stone vault
#

You mean the replication?

stone vault
#

You can also do it in the bp like I showed above.

summer tide
#

My horse and player animbp looks the default 3rd person template animbp

#

That code works in standalone only. But if I use 1 client then no

summer tide
slow hornet
# stone vault Unless you plan to have multiple servers up, you need to either load the map in ...

Thanks Riane but what i have been told here before, is that I can't have two levels loaded on the server at the same time. So because of that I can't have player 1 on level 1 and player 2 on level 2. I already tried before the seamless travel of a single player to another level and it doesnt work properly, is it true that it a single server cant have 2 levels loaded? thats my question thanks a lot

stone vault
stone vault
#

Watch that

slow hornet
#

yeah I was checking now that, thanks a lot!

i have a question though, how do this relate with world composition? I mean... imagine that both levels are just a simple plane both on coordinate 0,0,0 ... if i have level A loaded initially and then stream level B, what will result is two planes in the my world correct? its everything happening on the same world, what i would need to do is stream out the level A and stream in the level B.

Is this correct? thank you!

stone vault
#

It depends on your distance settings and how you set it up, but yes. I've personally streamed a multitude of layered maps into one server. That's how a lot of lower level MMOs do it.

#

You can make them appear entirely seamless. Just check the tutorial, and look up more on youtube. Just search 'multiplayer level streaming' or something like that.

slow hornet
#

ahhh i got it, you make them on different Z position

#

that's clever!! i didn't thought of that

stone vault
#

It's just like setting up a grid.

#

🙂

slow hornet
#

finally i got all my answers 😄 thank you so much!

stone vault
#

A key thing to keep in mind is, the more actors and events and things per map you're streaming, the smaller you want them. So if there's not a lot per map, you could do a grid of like 4 maps, at 300x300 meters for example. If they have a lot of stuff, then do 8 maps at 150x150

#

And that's how you get better optimization

#

better performance

#

I do the same with multiplayer lobbies. I have my character selection map that all players start at, which is only accessible/visible to the players in the login/character selection. Once they go to the main map, what I'm really doing is teleporting them to the player start location (or their last coords) and they can no longer see/access the login map.

#

So it can all be run on a single server. If you plan to have a HUGE game with a ton of people, you want your login stuff to be on its own server.

slow hornet
#

makes sense!

stone vault
#

Yep.

slow hornet
#

thanks a lot for your help!

stone vault
#

No problem. I'm no expert but I'm happy to help where I can.

slow hornet
#

👍 💯

stone vault
#

On a side note, I'm preeeetty sure that Ark also does level streaming, and it was made with UE4.

#

But that's just a guess from having played it and picked at it a bit.

slow hornet
stone vault
#

You're trying to make a large open world sort of map, right?

#

You can adjust your world composition if so. If you're trying to make it more like individual levels which aren't connected, you could still use it. It just depends what you're trying to do.

slow hornet
#

yes open world, I am helping my level designer figuring out the limits of ue4, he keeps mentioning that we will be limited to the boundaries of world composition so the open world can have the maximum size of that world composition boundary size (yellow square). and now I understand I can easily use level streaming for performance (so not the entire persistent level is loaded), but that doesnt help me in achieving an unlimited (its not what we are trying to achieve, but just to be aware) world map size on the persistent world itself. But you are saying I can adjust the world composition? you mean the maximum size?

dull lance
#

quick question: What is an optional way to spawn "Floating" ACharacters and not have them have gravity applied to them until desired?

It's a multiplayer game, so would prefer avoiding having to start with a disabled character movement component, create yet another replicated variable, to do CharacterMovementComponent->Activate() [using C++ btw]

#

I am spawning them in the middle of the world

stone vault
#

So if your map is so enormous that you're truly concerned about the size, that's more an indication of an issue in planning, IMO.

stone vault
#

There's probably tons of other ways but that's off the top of my head.

dull lance
#

It is the gameplay character though

slow hornet
stone vault
slow hornet
#

would be nice 😅 thank you ! cheers you too

stone vault
#

Yep. Don't give up.

dull lance
#

That's not really the problem

stone vault
#

Well, you're saying you just want the character to not be limited by gravity at certain times, right?

dull lance
#

Only thing I need to achieve is to prevent the ACharacter from having active gravity from spawn for X amount of time / until a call is made

#

No, just initially

stone vault
#

Then at construction in the character have you tried mesh > set enable gravity > uncheck?

dull lance
#

the "cheap" way is to do start with a disabled character movement component, create yet another replicated variable, to do CharacterMovementComponent->Activate()

stone vault
#

Ohh right, c++

dull lance
#

It has nothing to do with mesh

#

gravity in ACharacter is controlled by the charactermovementcomponent

stone vault
#

Have you tried setting gravity scale to 0?

dull lance
stone vault
#

If it's done from the movement component it'd probably follow the replication of that component, right?

#

Maybe make a custom event that's called by the server and replicate the event, and have it be a switch that flips the gravity scale?

grim rain
#

Hey guys for some reason the use controller yaw rotation does not work on the client, works standalone though fine. The set movespeed worked on client so im confused. How do i fix this?

wide portal
#

How do people usually go about supporting both dedicated and listen servers? e.g. since rep notifies don't fire on the listen server, would it be recommended to rely only on RPCs instead? Or to directly invoke the OnRep method when running as a listen server but not on a dedicated server? (i.e. for every property change do something like if (GetNetMode() == ENetMode::ListenServer) player_state->OnRep_Score();)

hollow eagle
#

You can directly call the OnRep method.

#

you don't usually do it based on listen/dedicated though, it shouldn't matter.

#

unless the logic you're running is purely visual, wouldn't you want it happening on a dedicated server too? And even if it is purely visual, imo the "if dedicated server" logic should happen inside the OnRep to simplify things.

wide portal
#

well, for example, I'm currently using an OnRep method in the player state to update the player's HUD when their score increases (GameMode updates score in the PlayerState on the server, client gets new score in OnRep and updates HUD). Dedicated server doesn't care about this update at all, and a Listen server only cares if it's updating its own PlayerState.

#

But maybe there's a better way to organize things in general which would avoid the whole problem altogether 🤷‍♂️

thin stratus
#

I usually call the OnRep on both ends and filter dedicated server in the OnRep

#

Unless it's purely visuals then you could also filter the OnRep call itself

#

As long as you remember that when you suddenly need the OnRep for the Dedi again hehe

peak star
#

I connect to my dedicated server using Execute Console Command BP node with "open 127.0.0.1" as the argument. The client lands on the dedicated server start level. It does this even when the server has moved onto another level. When I do this on a listen server, then the new client joining by the same method arrives in the same level with the server player that it has moved on to (such as a lobby or.gameplay level). How do i get it to behave that way when joining dedicated server by "open" ip address command, instead of landing in the dedicated server start level?

#

I know there is a session created successfully because Find Session and Join Session nodes give the desired behavior. But once i put this in the cloud then OnlineSubsystemNULL is not going to know how to find the sessions out there

#

So i need to get to the dedicated server by opening the specific ip address, AND have it open into the same level as the other players are playing on instead of the dedicated server start level.

kind ember
peak star
#

Before having multiple servers will work, I will need to solve this problem where joining a dedicated server by ip address goes to the wrong level instead of joining the level all the other players are on.

#

Maybe I am missing a step I have to do when joining a dedicated server that I dont have to do when joining a listen server in the same way?

#

I thought just open level: ip address would be good enough (it is good enough for a listen server)

kind ember
#

Its the same, "JoinSession" node ends up executing cmd "open ip" in c++.
Are you using seamless travel?

chrome quest
#

Does anyone have information on the current state of the Network Prediction Plugin? I'm thinking of giving it a try and I want to know if it's useable for shipping. Also, does it address the performance issues of the character movement component?
Any response will be appreciated.

kindred widget
#

@chrome questNot sure about the rest, but a large portion of the CMC performance isn't networking. It's sweeping movement. Personally, I wouldn't trust plugins until I'd read through them myself And on top of that, networking is often best done manually based on your own game needs.

#

You'll probably spend less time just learning the basics of networking to make your own prediction than you will sorting out the bugs with a plugin while not knowing how it works.

pallid mesa
#

is there any place in the gamemode where I could ensure that the GameState is completely initialised and begin play has executed?

kindred widget
#

If memory serves, GameState calls beginplay on all actors doesn't it? I'd assume that Gamestate would be valid and up by then. Alternatively you could just call a function from server's Gamestate in the GameMode after your GameState's initialization is done.

thin stratus
#

GameState should be the one executing BeginPlay

kindred widget
#

Er. That, yeah.

thin stratus
#

GameMode has InitGameState to set stuff up. But that doesn't take BeginPlay into account

#

If you need GameState BeginPlay, execute your stuff in exactly that

pallid mesa
#

thing is that I have a wavemanager component in the gamemode and I wanted to connect it to a component that lives in the gamestate

thin stratus
#

Yeah InitGameState should work then?

pallid mesa
#

mh but the delegate is created in the beginplay of the GS agg hehe, you see what I mean? maybe going gs->gm just on server might be better in this case

chrome quest
kindred widget
#

Well, first place I'd start is it's sweeping movement. It's really brutal. Even in singleplayer, you're hard pressed to get above 200 with stable framerates with nothing else in the game. If that is taking up a lot of time on the gamethread on your server that'll hurt just as much as networking being unoptimized.

peak star
twin juniper
#

If i invalidate a FGuid on server, it will still be valid on client ? 🤔

rough kestrel
#

hey I need some help for basic setting up multiplayer for VR.

thorny jay
#

anyone can explain me why we need ue source code to build our dedicated app server?

twin juniper
#

So you build it apart

thin stratus
#

That wasn't the question though

#

The question is why they can't do it via the Launcher Binary Build

#

Mainly cause Epic chose to not include the required files for it.

peak star
#

What do I need to do in order for a client joining dedicated server to go to the level the server is on instead of the server start level?

thin stratus
#

I would suggest you start enabling some LogNet, LogOnline and what not and set those to VeryVerbose

#

And check what your log says

#

A simple NULL Subsystem Client connecting to a NULL Subsystem DediServer should work just fine.

slow hornet
#

hi guys quick question,

i am using dedicated server mechanism, and i am thinking about if this is the right way to do it.

The server will save the progress of the player, so when player opens the game the initial level (Game Default Map) won't be of any purpose, i will fetch game sessions and join while there, so the game default map can even be a black screen.

Then after he joins the session he goes to the Server Default Map, but before entering there I would like to have an option to choose character, i believe I would need to put the character selection on that level but on higher Z coordinate and then after choose teleport the player to the right player start.

Is this the way to do it? I don't want the player to create new character before joining the server (so on Game Default Map), because there will be an option to continue game, and the server itself must know when option continue is available or not looking at save files for that player that joined.

Does this make sense??

thorny jay
slow hornet
#

you have to fetch the engine source code and compile it

thin stratus
#

Yeah, you need the GitHub version and compile it yourself to get all the required target files to build and package a Dedicated Server

thorny jay
#

thanks a lot.

peak star
vivid seal
#

okay so i've been using RESET_REPLIFETIME_CONDITION to allow me to add a SkipOwner condition to a replicated property in a child class, but I can't find anything that would allow me to do a similar thing with OnRep. Basically in the parent class I just want a property that replicates normally with no RepNotify, but in the child class I'd like to add a RepNotify. Is this possible?

chrome bay
#

It's not no, has to be done in the parent

#

Just mark the OnRep as virtual

vivid seal
#

okay thanks

vivid seal
#

between NetMode, Role, and RemoteRole, is there a good way to just check "is this actor a listen server, a listen server version of an auto proxy, a dedicated server version of an auto proxy, or just an object controlled completely by the server"

i know for the last one, I can check remoterole == SimulatedProxy, but for the first three they all return RemoteRole == AutonomousProxy and Role == Authority. I need a way to check if the actor IS the listen server, or simply another player on the listen server's instance of the game. I know there's a IsLocallyControlled check for Pawns/controllers, but that requires my components to be casting their owners and checking if they are pawns, which seems to kind of defeat the purpose of encapsulating a lot of stuff in components

vague fractal
#

Just wanna be sure before it's possible while i'm just doing something wrong.
Is it possible to fire a OnRep in such a case here ?

//Character class
UPROPERTY(EditAnywhere, ReplicatedUsing = OnRep_LeftHand_EquipmentChange)
USkeletalMeshComponent* M_LeftHand;

Where it will fire when i set a new skeletal mesh like here ?

M_LeftHand->SetSkeletalMesh(nullptr);

Or would the OnRep only fire when i do something like this here ?

M_LeftHand = nullptr;
vivid seal
#

i guess a more general question is do you guys know of any good resources dealing with designing for both listen and dedicated server compatibility

kindred widget
#

@vivid sealI don't know if any resources really, but in general it's just common design practice. Basically all of your Listenserver controls and whatnot should be done just like a client's. This leads to all players having identical gameplay whether they're the server player or not. Don't make any Listenserver specific stuff, and in the end everything should be portable between the two modes.

#

For instance, one good example is that a lot of people like to purposely not call Server RPC for player input controls on a listesnserver machine. Instead, they branch and call a different function. When in reality, you should just call the server RPC for both client and server players. The ServerRPC just won't network if it's called from the server, but will still run the same functions. This'll lead to having consistent controls across both modes.

vivid seal
#

i'm mostly concerned about prediction stuff, I don't need any client prediction code to run if I'm on the server

#

i can gate it all behind Role_Authority, but there's so much stuff that is in the code path

kindred widget
#

I'm pretty sure most of that is based on the actor's role

vivid seal
#

is there any issue marking variables as replicated to owner only if the owner could be the server?

#

the replication just won't happen right? no onreps will be called?

kindred widget
#

Pretty much.

#

Well, at least in C++. OnReps are always called in blueprint whenever the variable is set to something else, even on server. But if you're doing network prediction and using roles I assume you're using C++

vivid seal
#

yeah

peak star
#

@thin stratus @kind ember I think i know what my mistake is now. As a listen server all i had to do was have the hosting client open the level, but with a dedicated server I need to have a client who is controlling the host make an RPC to the dedicated server (in this situation that player is NOT the same machine as the dedicated server) telling the dedicated server to open level, not have that client player open the level.

#

In my game the first player to join the server gets to decide options like which level and game mode are going to be played by everyone on that server

peak star
#

I tried using the rpc way and now the dedicated server actually changes levels like it should, but the player gets kicked off and has to manually rejoin. Is that what your advice to call Client Travel (or what is it called?) Is about?

eternal canyon
#

U have to use server travel to move all clients with the server @peak star

peak star
#

Okay so originally it was listen server only so I didnt have to do that at this point in my game's flow becuase the lusten server client was the only player there and that was on its own machine so open level alone sufficed. but this time it is dedicated server so yeah exactly what you said. It makes sense now.

short arrow
#

When should something be marked reliable? I just realized over 2 years of multiplayer experience, I have never really paid attention to it.

summer tide
wide portal
#

When should something be marked reliable? I just realized over 2 years of multiplayer experience, I have never really paid attention to it.
If not receiving the message could break things in a bad way. e.g. spawning a rocket? If one client doesn't get that message they may die without any apparent reason. Spawning the muzzle flash when the rocket is fired? It's probably fine if that gets lost somewhere.

eternal canyon
wide portal
#

sure, maybe it's not the best example, but you can get the idea

#

The client telling the server they want to spawn a rocket, or perhaps the server telling a player that they died are better examples

#

It really depends on the game and the implementation, though, so the only real rule is "will something important break if this message gets dropped?" Muzzle flashes may be unimportant visual details in my game, but maybe you're building a stealth-oriented game in which muzzle flashes convey important strategic information to players, which would put any player that doesn't see one at a disadvantage. Similarly, if you are regularly sending a buffer of each player's inputs to the server, then the "client wants to spawn a rocket" example doesn't need to be reliable since even if one packet gets dropped the next still contains the missed inputs from previous frames.

sinful tree
# short arrow When should something be marked reliable? I just realized over 2 years of multip...

From what I understand, it should be used when something is very important to gameplay, however, it should never be something that is done rapidly, or overly frequently as it can end up clogging the network with retries. If you need something rapidly, then perhaps the RPC should be done once and instead just transmit a state instead so the client or server can perform the action until the state changes again (on a separate reliable RPC of course!)

One way which I've used it is for notifying the client of data that the client should know and would otherwise break the client if they didn't. Eg. Turn-in of a completed mission. The client notifies (using a non-reliable RPC) the server that they're requesting to "finish" a mission. It wouldn't matter if the client's "request to finish" the mission didn't go through, as the client would be able to try again anyway if it didn't.

When it does receive the request, the server will verify the requirements of the mission are satisfied, and then mark the mission as complete and then notify the client (using a reliable RPC) that the mission has been completed so the client can clean up and display whatever it needs to (remove UI elements, play sounds, etc.). If it wasn't reliable and the client didn't receive the update, then the data on the client and server would be out of sync and without a proper means of "refreshing" the information client-side that would give them the required feedback that the mission was completed correctly.

dark edge
#

Basically, continuous vs one-off actions or data

dark edge
peak star
summer tide
#

Should I put all of my blueprint code of playing montages based on turns and moveforward values in my component or in my player BP, which will favor replication?

vivid seal
#

so IsLocalController checks that a controller's remote role is != Autoproxy and that local role == authority.
does this mean that on listen servers, IsLocalController will actually return false for the hosting player's controller? since listen server for whatever weird reason has remote role set as autoproxy.

fast arrow
#

Hello, What is the difference between NetSerialised struct and just default struct replication? And can i use NetSerialisation for replication TMap?

chrome bay
#

A custom NetSerialize function will send everything you serialize everytime, or you can implement custom delta replication. Replication of TMap's is not advised, just use TArray and a wrapper struct.

#

But yeah, you could do it if you really wanted to.

#

Default struct replication will send changed properties individually.

fast arrow
#

Im using GAS and when i confirm targeting it crashes saying i need to implement NetSerialize for my struck) So thats why i got curious)

#

Thank you

chrome bay
thin stratus
#

Is it possible that UE4 replicates properties that are marked to work with the PushModel, but aren't marked dirty?

#

Because I had a variable that was marked as replicated and to rule out that it causes issues I removed the MARK PROPERTY DIRTY stuff

#

But the problems persisted. Now I completely removed replication of it and it resolved itself. Makes me wonder if it still replicates

#

I assume if only one single property in the Actor or UObject is not using teh PushModel, UE4 checks for dirty properties anyway and replicates everything?

#

Or even maybe even if only one single PushModel property is marked dirty, it will collect all changes, which would be the property I didn't want to mark dirty, and replicate them all to the client

winged badger
#

its always possible that unreal screws something up

#

we had an actor that didn't replicate its initial state on initial replication if one specific replicated property was changed before client joined

#

to make it a perfect shitstorm, part of initial replication was the seed for a procedural map, and we caught it on release day

upbeat basin
#

Is it okay to replicate a struct that have TMap as member, considering TMap itself can't be replicated?

modern cipher
#

You cant call an RPC on an actor in the game world without an owning net connection
Is it the same case for replicated variables to receive changes from the server?

sinful tree
sinful tree
fast arrow
#

What should i do with struct that use custom NetSerialize and that contains field with struct type of FFastArraySerializer?

lusty sky
#

TMaps dont replicate at all

#

TArrays do

#

you can use an array of struct instead of a map

fast arrow
#

i know, i just dont undestand hot to NetSerialize struct type of FFastArraySerializer

#

coz if i understand it right i need both

upbeat basin
upbeat basin
fast arrow
#

i got struct with an array of struct and some other fields. All of this must be NetSerialized. So i have to make NetDeltaSerialize for the array as i understand it, and then NetSerialize for fileds in the struct and array as well, right?

upbeat basin
#

Another question though, is there a more detailed game framework diagram other than the one exists in official docs that shows the creation order of PlayerController, PlayerCharacter, PlayerState as well?

lusty sky
fast arrow
#

And i need to do NetSerialize for the struct that is in the array as well?

lusty sky
fast arrow
fast arrow
#

i think i figure out the way for my case. I checked how epic serialize their types. In case of FVector2D they just do this
bool FVector2D::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess) { Ar << X; Ar << Y; return true; }
No over complication. small type, easy serialization.
So i think my it will work in my case coz my struct is quite small

`struct FMyStuct
{
GENERATED_USTRUCT_BODY()
UPROPERTY()
TArray<FOtherStruct>Items;

UPROPERTY()
int32 SomeInt;

UPROPERTY()
bool SomeBool;

UPROPERTY()
FVector SomeVector;

bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
Ar << Items;
Ar << SomeInt;
Ar << SomeBool;
Ar << SomeVector;
bOutSuccess = true;
return true;
}

};`
Right?

thin stratus
#

Hm yeah

#

You could use SerializeBits(&SomeBool, 1)

#

As well as use some NetQuantized Vector

red salmon
#

So I have a problem with player names the widget component does replicate the player name though it only does this for players that just joined and when a player that joins later than another player will not see that player's name. Any ideas on what to do?

red salmon
#

tried it

dark edge
#

Show how you're getting the name to the widget

#

To reiterate, nothing about the widget should be replicated. You just need the name itself to be replicated.

red salmon
#

Player name display is just connected to a text box that is part of the widget component

thin stratus
#

Yeah it's sadly not that easy

#

There are so many edge cases you aren't taking into account

#
  • Multicast when it's already RepNotify variable is redundant.
  • PlayerState could not be replicated yet when the RPC arrives.
  • Player might not even be possessed yet, which also means it has no PlayerState.
  • PlayerState can be valid but Character not yet.
#

It's generally easier if you use a binding here

#

Get the WidgetComponent on BeginPlay, get the Widget out of it and set a pointer to the Character

#

In your code where you set the text, get the PlayerState from that Character and then the name.

#

Make sure you check all pointers for IsValid

#

It#s of course not good to use Bindings, but here it should make your life a lot easier

#

Otherwise you will have to account for all sort of race conditions

vague fractal
#

I just found a problem with my.. older code.
I've used a multicast to equip stuff, but now i know how wrong this way was.
I'm just not sure if my new way would be just as bad.

void UPlayerInventorySystemComponent::Server_EquipItem_Implementation(const EEquipmentSlot TargetSlot, UItemData_EquippableBase *NewEquipment)
{
    Multi_EquipItem(TargetSlot, NewEquipment);
}

This was my old code, my new plan would be to create a struct marked as OnRep which stores both parameters. How badly would this be ?

dark edge
#

@vague fractal what we do is use an RPC to request the equip from the server, but the server does the equip. The currently equipped item is replicated, no multicast RPC

meager spade
#

i use 0 multicasts for equipping weapon (apart from some visuals for the equipping)

fast arrow
# thin stratus Hm yeah

i've seen they use SerializeBits for flag serilization like this
`uint8 RepBits = 0;
if (Ar.IsSaving())
{
if (Instigator.IsValid() )
{
RepBits |= 1 << 0;
}
if (EffectCauser.IsValid() )
{
RepBits |= 1 << 1;
}
if (AbilityCDO.IsValid())
{
RepBits |= 1 << 2;
}
if (bReplicateSourceObject && SourceObject.IsValid())
{
RepBits |= 1 << 3;
}
if (Actors.Num() > 0)
{
RepBits |= 1 << 4;
}
if (HitResult.IsValid())
{
RepBits |= 1 << 5;
}
if (bHasWorldOrigin)
{
RepBits |= 1 << 6;
}
}

Ar.SerializeBits(&RepBits, 7`);
#

so this is just a better way to serialize bool for networking?

vague fractal
#

My currently equipped item is basically just a replicated USkeletalMeshComponent, but if i only set the new skeletal mesh via the server it will only be visible for the server :s

dark edge
vague fractal
bronze summit
#

What is the proper class to implement player death in? My current idea is to unpossess >> possess spectator pawn with fullscreen respawn UI and spawn a new player character upon button press. Kind of unsure if I should use PlayerController or PlayerState for this as spawning is server sided anyway.

thin stratus
#

Depends on what this entails

#

Any information that everyone needs to know about?

#

Time until respawn for example

bronze summit
#

Well not really Im making a small survival game and just like Rust for example they spawn on the client said location

#

The only thing I can think of is a ragdoll but that would happen after unpossesion anyway

thin stratus
#

Then most of this can be handled via PlayerController and GameMode

#

Ragdoll can be handled via TearOff and TornOff (cpp)

#

So yeah that's character

bronze summit
#

Kind of try to stay clear of PlayerController sometimes but in this case its kinda tricky

thin stratus
#

Why though

bronze summit
#

Thats actually a good question

thin stratus
#

Using classes for what they are meant to be used is critical

#

Otherwise ue4 multiplayer becomes hell

bronze summit
#

Well yeah most logic I implemented untill now didn't really go outside the character itself because its groundwork for movement and combat and some inventory stuff. So I am kinda new to using a playercontroller in a MP environment

#

Sometimes I feel like there are to many classes but really the playercontroller does suit best for the scenario I asked before because it can just listen on a delegate (is death in this case) and process it

kindred widget
#

Focus widgets are also a good use for very specific keybind useage like that, which you can't exactly put in a pawn, but might not always want to check behind gates for in the controller.

vague fractal
lusty sky
#

Thats something to do with PreNetReceive and PostNetReceive i guess.
You have to cache the old one and compare after PostNetReceive

violet sentinel
#

I have a class that represents diplomacy matrix and other features existing in my game state .
It works great until I realized that I need to replicate it 🤕 .
How would be possible to replicate it, adding to replicated subobjects?

UCLASS(BlueprintType, EditInlineNew)
class UDiplomacyMatrix : public UObject {
   uprop int32 size
   uprop array rules
   uprop(transient) array cachedMatrix
};
UCLASS()
class AMyGameState : public AGameStateBase {
   uprop(Instanced, BlueprintReadonly) UDiplomacyMatrix* Diplomacy; <- ???
};

bool AMyGameState::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
    bool bModified = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
    if (Diplomacy)
           bModified |= Channel->ReplicateSubobject(Diplomacy, *Bunch, *RepFlags);
    return bModified;
}

void AMyGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
        Super::GetLifetimeReplicatedProps(OutLifetimeProps);
        DOREPLIFETIME(AMyGameState, Diplomacy);
}
#

i really do not want to resort to embedding it back into game state or resort to structs

#

as it makes things very bad to use in blueprints

chrome bay
#

yeah, via replicate subobjects

#

May as well use an actor component though tbh

lusty sky
# violet sentinel I have a class that represents diplomacy matrix and other features existing in m...

if you already did override these in your UObject class

virtual bool IsSupportedForNetworking() const override;
in case you need to call rpcs
virtual int32 GetFunctionCallspace(UFunction* Function, FFrame* Stack) override;
virtual bool CallRemoteFunction(UFunction* Function, void* Parms, struct FOutParmRec* OutParms, FFrame* Stack) override;

bool AMyGameState::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags)
{
    bool WroteSomething = Super::ReplicateSubobjects( Channel, Bunch, RepFlags );
    
    if ( Diplomacy != nullptr && !Diplomacy->IsPendingKill() )
    {
        WroteSomething |= Channel->ReplicateSubobject( Diplomacy, *Bunch, *RepFlags );
    }
    
    return WroteSomething;
}
violet sentinel
#

i'm not calling rpcs on them

lusty sky
#

you will also need to instantiate your UDiplomacyMatrix with a valid outer actor to avoid GC

violet sentinel
#

only issupportedfornetworking

#

i assume actor will be valid since it is created in blueprint property editor of gamestate

#

still on refactoring state, can't launch to check

#

DSL

#

Discord Shortcuts Language

lusty sky
#

xD

violet sentinel
#

i extracted diplomacy from game state into struct first, then struct converted to uobject.
as there are more than one matrix possible for some cases, so there was SizeA, RulesA, SizeB, RulesB etc etc and bunch of methods for them driving me crazy

dark edge
#

@violet sentinel I'm not sure what your architecture looks like but for diplomacy, I would have the state exist in game state, and run the logic in game mode or on a subsystem

violet sentinel
#

not possible, too much stuff needed to be shared for all players and I can not use game mode

#

would think something on brand new project but not here

#

actually, will try with it being actor component

vague fractal
vague fractal
#

I'm using 4.25 atm and i've read that it's also not working on 4.26.
I think it's insane if it would only work properly with a source build

violet sentinel
#

did you test it ?

vague fractal
#

On 4.25 yes, but i don't have a source build

violet sentinel
#

shouldn't matter

#

just to test if it works

vague fractal
#

Well, it doesn't sadly. And as i said, it seems like it's a known issue since ages

violet sentinel
vague fractal
#

In my case it's a USkeletalMeshComponent, but yes.
That doesn't solve it 😢

violet sentinel
#

works with static mesh for me on 4.26.2

vague fractal
#

Does it also work with USkeletalMeshComponent's for you ?

thin stratus
#

What keeps you from handling it manually

vague fractal
violet sentinel
#

at all

#

you can browse the source

#

because it is quite uncommon thing to do

#

unlike static mesh

vague fractal
twin juniper
#

hey guys 🙂
what could be a reason why players can't join my server using advanced sessions steam?
They only get a few messages saying

Removed incompatible build: ServerBuildUniqueId = 0x00000000, GetBuildUniqueId() = 0x00fac1bd

#

well I'm using default app ID 480, but I've seen it work for other people

violet sentinel
#

ugh, this is a mess. team configurations, states and other data are in game mode class
but the team relations configurations and runtime data in game state

dark edge
muted perch
#

How does replication differ from using listen servers vs dedicated

#

ik that listen server acts as a client as well, but how does that change how you have to replicate things

blazing spruce
#

Hi, is there a way to make it so sound can be made relevant again? so i have a fan sound that'll play for like 30 seconds with attenuation set up and with the virtualization mode set to Play when Silent but if the player leaves the Net Cull Distance area it destory's the actor while the actor isn't relevant, but pop's back in to existence when the actor becomes relevant to the player.. same sort of thing but for the sound? so the 30 sec audio plays, player walks 20 seconds and gets outside the Net Cull Distance area but then walks back in at 25 seconds so there would still be 5 seconds left of the audio playing? Otherwise is it just best to increase the Net Cull Distance area to be big enough to last more than the audio clip plays?

dim minnow
#

Hello there. I have a question about server-RPCs: Is the corresponding _Validate-method also executed when the RPC is called on the server? Would it be ok to always return false in the Validate method if I want to enforce it to only ever be called on the server? (knowing that any client calling it would immediately be kicked)

muted perch
dim minnow
#

Yes, of course. But what does it mean when the RPC-call originated on the server, too?

#

The server can't be kicked, after all.

muted perch
#

Well that's up to you of who gets kicked because just returning false in an RPC will just make it so the RPC wont run, unless if you program it to kick if it returns false.

#

wait maybe idk

dim minnow
#

I'm not sure I understand. If a client calls a server-RPC and the corresponding _Validate-method returns false, the client is immediately kicked.

muted perch
#

i think im a bit dumb

dim minnow
#

(I had a lot of disconnected clients before I realised that. Had to move the validation code into the actual RPC.)

muted perch
#

ok

dim minnow
#

So now I am curious if I can make use of the _Validate-method in other ways. Maybe I can always return false and then the server would be the only one "allowed" to call the RPC? (Or maybe it wouldn't run at all, I guess.)

muted perch
#

but I don't know if you have to have validation for server to client RPC

dim minnow
#

I don't know, haven't needed that so far.

muted perch
#

Yeah, only Client to Server RPCs require the _Validate function

#

it sounds like if it tries to kick the server then all the clients will be kicked as well.

dim minnow
#

That's another possibility. I guess I should try to find the time to write up a test then.

graceful flame
#

Can anyone help me with destroying / despawning a character? I have a collision based character selection and respawning process working in multiplayer but the old actor isn't being cleaned up after respawning as a different one and I'm not sure why.

muted perch
#

are you unpossessing the actor that is to be destroyed?

graceful flame
#

Hmmm I didnt know that's even a thing

#

What is the order of cleanup? Disable, unpossess then destory?

muted perch
#

unpossess disable then destroy

#

but if you unpossess you wouldn't need to disable input

graceful flame
#

okay, and as a multicast right?

muted perch
#

are you using listen or dedicated servers?

graceful flame
#

dedi

muted perch
#

ok, try using server rpc

#

I'm not great with using rpcs, I just know the ue4 framework decently.

graceful flame
#

okay, thanks for the tips

#

got it!!! @muted perch thank you

dark edge
shy kelp
#

Can someone be in a different level and still be in the same session? I want to check if all players have loaded in the game level.

muted perch
#

you can just have the player controllers send an event to the game mode saying that they've loaded in.

#

also onPostLogin in the game mode can help

shy kelp
shy kelp
#

Which is why I asked if ppl can be on the same session but different level

muted perch
#

why would they be in a different level?

#

if the begin play is called on something that is owned by a connection, then the connection is on the session

#

but I think that a server can only host one level.

shy kelp
#

I'm not sure tbh, I just assumed so

muted perch
#

no, if they've fully connected then they should be in the level

shy kelp
#

So will every player leave the travel level at the same time?

#

Because tbf, I assumed the game moved you from the travel level after it finished loading the next 💀

muted perch
#

depending on how good there connection is they will connect at different times

#

you can just make it halt the game for people who have connected, then resume once everybody is in

shy kelp
#

I was planning on just starting the main gameplay loop within the gamestate after everyone loaded in

#

Also is there a node or cmd to check if a player is fully loaded or not, is there any easy way?

muted perch
#

if their player controller exist, then they've probably fully connected.

shy kelp
#

Oh ok, then its pretty easy

#

I can just check the number of player controllers and compare it to get current players from the session, and start the loop after it's equal

#

I assume

muted perch
#

The game state has an array of player states, you can just use that then tell the game mode that it's ready to start.

shy kelp
#

Yea makes sense

hollow eagle
#

This is not the place to advertise services.

dull lance
#

quick question: if I run APlayerState::SetPlayerName() from the client... will it replicate?

I see in its functions that it does run OnRep_PlayerName(), but I assume that I have to be the server to run that function?

subtle raptor
#

what is the correct place?

hollow eagle
#

If it's not directly related to unreal, not this server. If it is, #released.

subtle raptor
#

this is a services related to unreal

#

it´s only for unreal

dull lance
#

Good luck! definitely not this channel though

subtle raptor
#

It is about a multiplayer service for projects in ue4, do you think it does not go here?

hollow eagle
#

no, because you're advertising a service. Which this is not the place for.

#

read #rules - no self promotion.

subtle raptor
#

ok i´m really sorry

distant talon
#

there a good way to change the net cull distance handling for spectator players?

twin juniper
#

Does anyone know how to implement online features?

#

@subtle raptor What was he promoting?

subtle raptor
#

Hi

#

I was promoting a multiplayer system for UE4 proyects

#

Made with me

#

By me*

twin juniper
#

Ok ok

#

Put that away

hallow summit
#

I have a possess camera code in my player controller, but it's only working for the server not the clients. I've tried all the replicating options and nothings working, anyone know what could be going on?

meager fable
#

when I run a client rpc player controller 0 will always be locally controlled right?

thin stratus
#

If the rpc worked,... Yes?

thin stratus
thin stratus
kindred widget
#

@meager fableUsually yes, rarely no. It depends on the machine it ends up on. There are rare cases where GetPlayerController0 can actually return a controller that is not the local client's controller on listenserver machines. Game Instance's GetFirstLocalPlayerController is much better in that regard.

thin stratus
#

I haven't had an instance where GetPlayerController 0 on ListenServer would not return its local PC.

#

Dedicated Server is another story

meager fable
#

Can't find GetFirstLocalPlayerController, is that cpp only?

kindred widget
#

It happens with seamless travelling sometimes. It's semi rare, but can happen around loading.

#

And yeah, it's C++ only.

thin stratus
#

Hm okay

#

Benefit of never really using that node

meager fable
#

Guess I'll expose it, thanks both of you

woeful pebble
#

somebody help me on teams for multiplayer

kindred widget
#

I only ever used it in UI stuff before. I don't even do that now. 😄 Zlo blapped me for it after a weird loading crash.

thin stratus
#

Haha

woeful pebble
#

i can't figure out how i should implement them

dull lance
#

lol

woeful pebble
#

Anybody?

thin stratus
#

You'll have to provide more info. Your Teams have requirements which are needed to know before giving any advice. Also I'm pretty sure people already suggested options for you

woeful pebble
#

alright so how would i exactly would i have a leaderboard without having to loop through each controller and getting each player state?

dull lance
#

Leaderboard... you mean a scoreboard? [they're 2 separate concepts]

woeful pebble
#

yea

#

like i want to show each player's name and team they're in

dull lance
#

I mean... you could just do GameState->PlayerStateArray

#

and loop that

woeful pebble
#

yeah but is it costly on performance?

dull lance
#

what?

woeful pebble
#

i used an enum var btw

#

sorry i meant to ask

dull lance
#

I mean... not really

#

and if you're bottlenecked enough where for looping 15-20 player states goes over budget, then you have way bigger problems

woeful pebble
#

and for a score for each team i'd have to make two variables in the game state which is prob bad idea

woeful pebble
dull lance
#

I see that you're fairly new in the world of unreal

woeful pebble
#

yeah im not really good at multiplayer stuff

dull lance
#

have you looked at the network compendium?

woeful pebble
#

oh

woeful pebble
dull lance
#

unless your game is on mobile, you can just pretend you have endless Ram available

woeful pebble
#

what

#

?

dull lance
woeful pebble
dull lance
#

I'm fairly obsessed with encapsulation

#

so probably a replicating UStruct for handling match global stats

#

then each player would have a replicating ustruct [a separate one] in the player state for handling match player stats

#

[also, please don't say that this is a bp only project]

woeful pebble
#

it is

#

sadly

dull lance
#

[it's going to limit you big time in the future]

#

and if you plan to have dedicated servers, you'll have to eventually convert to a c++ project anyways

woeful pebble
#

but would i loop through the player states and then add the score of each player together?

dull lance
#

That's up to you shrug

#

also depends on the game mode etc

woeful pebble
#

mine is suppose to be tdm

#

team death match

woeful pebble
dull lance
#

I can't tell you what the best way is without really knowing what you already have though

#

and the fact that you're just on Blueprints only is already [in my book, fwiw] suboptimal 😛

woeful pebble
#

hmm is there a good C++ alternative?

dull lance
#

yes. Doing it in C++ 🙂

#

One of the bigger issues with BP-only systems (you might have experienced this already) is that encapsulation is almost never done right; all systems are messy from everywhere, enums & structs & classes are an absolute mess, and everything is just this ugly conglomerate of things

woeful pebble
#

i have no problem trying it but like what would you

#

do

dull lance
#

and follow that line /set of msgs

#

using things like ReplicatedUsing (C++'s version of RepNotify) and the like.

woeful pebble
#

No like to store the variable of the player where would you put it

#

in c++?

#

where would you put it?

dull lance
#

I did mention it in my msg above

#

UStructs are declared in c++

#

I'm of the preference to declare most important data types & classes in c++ [includes structs and enums]

woeful pebble
#

but in which class would you store that variable

#

like would it be parent and child

#

or

dull lance
#

I mentioned that higher above as well

#

Match Data -> GameState
Player Data -> PlayerState

woeful pebble
thin stratus
twin juniper
#

Who told me to view instructions?

#

Yes, i saw that.

#

No problem

dull lance
#

I did. it was deleted by a mod, along with your message

thin stratus
#

If all you need is:

  • Player belongs to Team
  • Team has Score

Then it's enough to have the Enum in the PlayerState and two team scores in the GameState.

twin juniper
#

I agree with the rules

thin stratus
#

Or an array or so

#

You can make Teams a lot more complex of course

#

But you should just start somewhere

woeful pebble
#

anyways thanks

thin stratus
#

Then use an Array

#

Since you have an Enum you can match the Enum to the Array Entry

woeful pebble
#

um but... how exactly would i do that off of post login?

#

No like

thin stratus
#

What defines the amount of Teams for you?

woeful pebble
#

i just need three

thin stratus
#

Always?

woeful pebble
#

but i kind of was thinking i could use an array but off of post login it only gives a controller reference so i don't know how i would add that to an enum array

#

not always but for this specific project im working on

thin stratus
#

We are talking about scores or not?

#

Why would you need that at PostLogin

woeful pebble
#

No like, once the game start i call an event, im just temp using it on post login

thin stratus
#

It would be best if you'd outline the requirements for this, before people can really help you

#

Everyone here probably does Teams a little different

#

And most of us probably use C++

woeful pebble
#

So there's a timer, once the timer is done counting down the game start and there's a timer for the round's time. It then assigns you to a random team. that's kind of it other than spawns but i can do that later

thin stratus
#

Yeah, so the Array in the GameState could either hold some TeamActor, or some Struct. Either way you'd probably have the info of the team in there.
Such as Array of PlayerStates, a Score value, etc.
When you assign that team you can get a random number between 0 and 2 and add the Player to the Arrays Team Info, as well as set the Number on the PlayerState.

#

Or you do some balancing magic so not all of them end up on the same team

#

If you know you have 3 teams all the time, you'd just need to make sure that you set the default value of the team to 3 entries

#

Otherwise you can also just call Add on it three times on the begin play of your GameState or so

#

There isn't much more to it

#

I'm not going to show you code. You'll have to just start digging into it

woeful pebble
#

Alright ill try some stuff out and see if its good

#

anyways thanks for that man

thin stratus
#

Let's assume an Enemy can be Launched based on my Attack.
How does one make that smooth? AI Movement is Authority Based, so I only have 2 options: Call it on Auth alone, which means a slight (or long) delay before the Client sees this. Or. Call it on both, but then usually run into a correction, because nothing of this is synced, cause the Client is just simulating the AI.

#

The only way I can see this being smooth is if the Client would be allowed to take over "auth" on this, as long as the Server says it's okay. But I doubt the CMC has code for that on simulated proxies

summer tide
#

DO I have to set the movement mode in server or multicast or run through HasWuth?

chrome bay
#

Client could simulate it from replication, then the server could check to make sure they did simulate it - but it's probably more trouble than it's worth, might be worth a one-off correction now and again.

#

Almost becomes two layers of prediction. Server prediction what the client will predict 😄

#

Sort of a losing battle though, because if client A pushes Client B, then they've got to wait even longer for the feedback (their own RTT + the victims RTT)

thin stratus
#

It's not about Clients, but it could be

#

It's just the AI being Launched by ClientMovement

#

It's not a correction now and again

#

It's either always delayed or always corrected

#

It's never smooth, not even on 30ms ping.

#

The Client can't launch the AI after all

blazing spruce
#

Hey

#

Whats the best way to replicate sound properly?

bitter oriole
#

You don't replicate sound, you replicate the information that the sound should be played

blazing spruce
#

Sorry i didn't put that in the best way.. what im actually trying to do is make sound relevant.. for example i have client 1 inside the net cull distance area, and client 2 outside it, the one inside presses the button which plays the sound, then client 2 steps into the net cull distance area but doesn't hear the sound, can i make the sound relevant to client 2 if they weren't in the net cull distance area when the sound was originally played?

chrome bay
#

Nothing about playing sound is networked by default, regardless of cull distances. Unless they play a sound locally, they'll hear nothing.

blazing spruce
#

Thanks, so what do you think is the best solution?

#

worst case i can just increase the size of the net cull distance to be longer than the audio plays so it's always relevant to them i guess but if theirs a better way i'd rather try that lol

chrome bay
#

Has the playing of that sound already been "networked" by you?

#

If the sound is driven by some replicated property, you can use a timestamp of AGameState::ServerWorldTimeSeconds and replicate that, then drive the sound from an OnRep, checking the timestamp at the same time.

#

Without any context it's hard to give an answer

blazing spruce
#

Im not entirely sure, this is the first time ive delved into sound's working for multiplayer so im not sure if ive 'networked' it or not lol all i know is that i have a custom event thats set to Multicast that plays the sound which is stored in an audio component in the BP actor which somewhat works, if both players are inside the net cull distance its fine, if you're out of the attenuation zone but still inside the net cull distance and go back in range you'll hear it just fine so it just figuring out how to make it work when you leave that net cull distance area

#

but like i say im pretty new to the multiplayer side of things and cant seem to find good resources on sounds in multiplayer

chrome bay
#

A multicast is only called once, and only for players the actor is relevant too. If you want the sound to play when a client comes back into relevancy range, then it's technically a "stateful" change and should be handled via a replicated property instead.

#

If a player doesn't receive a multicast at the time it's called, then they never will.

blazing spruce
#

Ahhh ofc.. i forgot about multicasts only playing once while relevant! So how would i go about setting this up? for this particular on its a tap that gets turned on and plays a continuous sound of running water until its turned off

#

thats how ive got it setup so far

chrome bay
#

If it's a continuous/persistent change, then it's "stateful" and therefore should be handled via properties

#

This will also handle the case where a player joins a server during an in-progress game.

merry harness
#

Hiho, I have a few questions about different characters.

I have all the settings in my third person character so the character can Idel, Run, Jump, Sneak, Health and Manabar work, as well as the EXP and Skillpoint System.

Now I wanted to create different characters from the third person character with the help of Create Child.

Will the childs have their own life and mana or is this tied to the Parent_Character?

Every character has special skills that have to be added to the skill tree, how can I assign this to a character?

Despite the change of the Spwncharacter, I always start the game as a third person character, where (except in the game mode) do you have to change this?

#

One more question about the skills.
Is it really necessary for each skill from the skill data table
Get Data Table Row 1, 2, 3, 4 to be selected manually or I could make a kind of array in which is stored:

Character 03 has skill (data table row) 1, 5, 7, 9, 11 and exactly these rows are then loaded automatically?

waxen socket
#

Good morning, I'm back with more questions about replicating projectiles for those generous enough to answer.

This time I'm replicating a slow-moving enemy projectile that spawns either on a timer or when the enemy is shot by the player.

These "projectiles" are actors but they don't use the Projectile Movement Component. Instead, they are attached to the enemy that fired them, thus they continue to move and rotate with the parent while SetActorLocation moves them ever outward from their parent.

Any advice on how to optimize the syncing of movement between server and client of these projectiles would be much appreciated. Even if that advice is just to enable bReplicates and bReplicatesMovement and call it done.

Cheers.

twin juniper
#

Is there someone here that is using the PreReplicateAdd/Remove from FFastArraySerializer to update their inventory ? I wanted to know if it was overkill to use it only for ui changes 🙂

dark edge
#

@waxen socketIf the attach parent's movement is already synced, that should be enough information to sync the projectiles up right? You shouldn't need to replicate movement directly, just attach parent

woeful pebble
#

so i was wondering why this wasn't working but i can't seem to add to an array in a struct it doesn't save. Like the length of the player state array is always the same

tardy glacier
#

Morning - I'm trying to work on getting ReplicationGraph working with my project (using https://github.com/MazyModz/UE4-DAReplicationGraphExample as a base along with his tutorial video + Epic's live stream recording on RepGraph) but so far the only thing I'm noticing is that it makes networking worse. AI characters pop extremely bad (despite setting them as dynamic actors just to test) and intro cinematics no longer sync up properly and this is without the UE4 bad net sim running.

Am I missing something with set up here? Is there a project config I need to set or some other code that needs to be added aside from the RepGraph itself and the delegate to turn RepGraph on?

GitHub

An example project of how to use the ReplicationGraph in Unreal Engine - GitHub - MazyModz/UE4-DAReplicationGraphExample: An example project of how to use the ReplicationGraph in Unreal Engine

twin juniper
twin juniper
#

Take the official one on the epic launcher

tardy glacier
#

Ah, a fork

#

Is it not up on their github?

twin juniper
#

Nope

tardy glacier
#

Well that's something.

peak sentinel
#

You can find it on Epic games launcher

tardy glacier
#

Looking for that now, thanks

meager spade
#

its under the learn section

lost inlet
#

please pastebin

#

or attach it as a file

next falcon
#

So, the rotation only replicates if the camera moved, can someone confirm this ?

  1. Create Project with a player controller
  2. insert the BP in the image
  3. start server and client
  4. see the problem
dark edge
next falcon
#

so the server knows where the player is looking..
But why is it replicated if the player moves then ?

fast arrow
#

Oh sry)

meager spade
#

client can keep the server up2date

#

its in the playercontroller and pcm

#

client can send a rpc periodically

#

with its current view target

dark edge
#

The server-side camera of your pawn will sync up with your own, but the remote client one won't as you don't have their control rotation

chrome pulsar
#

I'm looking at using "Animation Budget Allocator" or "Update Rate Optimization" for reducing the rate of animation ticking on the server. Which one is better? Is it possible to use either on just the server alone while leaving the client unthrottled?

thin stratus
thin stratus
#

Movement that involves stationary objects works fine. It's only the moving ones that are a nightmare.
Cause Server and Client just don't have the AIs or other Players on the same location at the same timestamp.

#

But maybe it's also some replaying that goes wrong with the amount of custom movement we have

#

It's such a nightmare to debug this

#

The time I've spent comparing server and client timestamps...

kind ember
#

Did Epic ever released Fortnite's ReplicationGraph sources?

bitter oriole
#

Haven't heard of any Fortnite source release

fast arrow
#

hello, got a problem. I have 2 struct and custom net serializer. if i replicate them - everything is fine, But if i use them as a parametrs for a RPC - it crushes here
template<class CPPSTRUCT> FORCEINLINE typename TEnableIf<TStructOpsTypeTraits<CPPSTRUCT>::WithNetSerializer, bool>::Type NetSerializeOrNot(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess, CPPSTRUCT *Data) { return Data->NetSerialize(Ar, Map, bOutSuccess); }

and i have not good time at debugging it(

Exception thrown at 0x00007FFBB8084358 (UE4Editor-LearningMultiplayer.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000000000000008.

kind ember
meager fable
#

Is there a way to attach a debugger when launching the game by rightclicking on uproject? I have a crash when servertravel and that doesn't work in the editor :/

fast arrow
#

I figure it out. God damn it. I call client function both in cpp and bp - that was the reason for crush. Im so dumb... it took 2 days to figure it out.

meager spade
#

SHootergame is pretty close to Fortnite's

#

has some of the concepts they used in it

twin juniper
#

Is there someone here that is using the PreReplicateAdd/Remove from FFastArraySerializer to update their inventory ? I wanted to know if it was overkill to use it only for ui changes 🙂

meager spade
#

we use it for that and other things

#

that is the idea of it

twin juniper
#

Actually I ONLY use it to update my UI

#

Also how are yall managing ur inventory slots, are you passing the information you need to update ? i.e: UpdateSlot(ItemDefinition, StackCount); or are you passing the Item Object (In my case the ItemEntry.)

chrome bay
#

Depends

#

I normally just have the UI query the game for the info it wants, rather than other way around

#

And bind to events here and there, or just tick the whole lot

#

game code talking to UI directly quickly makes it hard to separate the two

twin juniper
chrome bay
#

tbf shootergame has possibly the worst UI of any of the templates

#

apart from all being done in slate it's pretty much inseparable from the rest of the game

#

Takes a while to rip that crap out

#

It predates UMG though.. by a few years or so

twin juniper
chrome bay
#

tbf the huuuuuuge majority of our UI is just ticking everything and it's far from being the bottleneck 😄

chrome bay
twin juniper
#

And anyway, i can't rly do tick update on inventory item add/change/remove and quickbar

chrome bay
#

Was based on ShooterGame originally but we had to remove all of that nonsense

#

UI is hard though. Such a weird middleground of programming and art so it can be hard to find the balance

twin juniper
twin juniper
chrome bay
#

yeah

#

definitely a lot to be said for trying to keep your UI and gamecode separate as much as possible though

#

makes things a lot easier

dark edge
twin juniper
#

But is this rly needed... I heard tick wasn't the way to go

#

Mmh ok

twin juniper
#

yeah

#

For example my UItem just store an FItemEntry (which is a FFastArraySerializerItem)

#

item object == UItem in this case

#

But the logic to send data to UI is still the same.. Do u send needed data or the whole "Object"

#

well english is not my native language i'm trying to speak as well as i can.

#

but thx.

#

Well how you want an inventory to work without UI 😄

#

Things like healthbar or scores are just cosmetic right

#

Yeah

#

im not ok with this.. we can do modular things between gameplay and ui

#

yeah but dedicated servers doesnt contain client code

#

so it's not a rly good example

dark edge
#

Does the UI just check if inventory changed on tick or something?

twin juniper
#

Same for removing, i send the item guid.

#

What is your game ?

#

I mean the type

waxen socket
fossil veldt
#

Yo anybody know how to get RepGraph running alongside SteamSockets? I tried the following in DefaultEngine.ini but no joy:

[/Script/SteamSockets.SteamSocketsNetDriver]
ReplicationDriverClassName=/Script/Hydroneer.CReplicationGraph
vague fractal
#

I guess this here is just a doc flaw, or ? (Same for Reliable)

Cuz i'm forced to use one of them on NetMulitcast's

violet sentinel
#

prob multicast is missed in docs

vague fractal
violet sentinel
#

not really

vague fractal
violet sentinel
fossil veldt
#

na you gotta put the client/server specifier

#

It's a requirement for RPCs

vague fractal
#

Well, just gonna note it as missing doc information then xD

fossil veldt
#

NetMulticast just fails if you run it on client

#

well you still gotta make NetMulticast reliable or unreliable no?

vague fractal
fossil veldt
#

hehe

vague fractal
#

Is there maybe any rule of thump when to use 1 RPC which takes a bigger object vs more RPC's which takes smaller objects ?

dark edge
vague fractal
violet sentinel
#

it is data size vs programmers sanity

#

depends

vague fractal
violet sentinel
#

none

#

if you using structs then unpacking packing variables just for rpc seems redundant

#

if you using parameters and number of them grows over lets say 6 then pack them into struct

vague fractal
#

I think i have to rephrase my question here a bit with some code

#
// Calling an RPC which takes this struct as parameter even though that only Health and Stamina will be used vs having 2 RPC calls which takes the parameter individually. So "Server_TakeHealth(Health)" and `Server_TakeStamina(Stamina);`
struct FDefaultAttributes
{
  int32 Health;
  int32 Stamina;
  int32 Mana;
};

If that makes more sense

violet sentinel
#

i think i got it. are they reliable rpcs?

vague fractal
#

Ye

violet sentinel
#

if they sent quite often i'd compact them to save on reliable rpc validation costs. since they probably have cost to check weither they were received by destination.

#

also search for "reliable buffer" here. may find references

vague fractal
#

if they sent quite often i'd compact them to save on reliable rpc validation costs.
What do you meant with "compact" here ? ^^"
also search for "reliable buffer" here. may find references
Yeah, i should really take a look into that

violet sentinel
#

Server_TakeEffect(Health, Stamina)

#

so it will be single reliable rpc

#

(if it suits)

vague fractal
#

So that you'd use default values if you don't use Stamina e.g. or ?

#

Nvm, got it, i think

violet sentinel
#

not sure 🙂 depends on design

#

still possible with smth like ServerUpdateStats(int32 ChangedStats, FStats Stats) where first is bitmask while second is container for values

#

quite wasteful on size as zeros are sent but multiple changes can be "compacted" into single rpc

#

and there seem to be better ways of making it

vague fractal
#

I see, think that's enough information for me now, thanks 😄

gleaming vector
#

i avoid using RPCs for state changes

#

if i can't help it

#

replicated variables are far more reliable and they don't have the weird replay effect you get sometimes

#

plus, a reliable multicast RPC can fail to reach a target if the target is outside of network range for that client

#

GAS handles this rather well with their replicated gameplay effects

#

if you don't want to implement GAS, you can at least take a look at how they replicate gameplay effects to do state changes

#

basically, they use a FFastArraySerializer with a modifer, and when it's received by the client it sends a callback

#

this works better than an RPC because when an actor becomes relevant to a client, network variables are updated and the callback is called

slow hornet
#

Hello everyone quick question, i am working on a multiplayer game and i already have my widget persisted during joining the server (using the gameviewportclient in c++), however right when the client joins the server my loading widget blocks for a second. how can i make it smooth? is there any workaround? or i really have to go with modules and slate like its showing on this video from Unreal Engine https://www.youtube.com/watch?v=ON1_dEHoNDg
Thanks a lot!

This engineer-oriented talk about assets loading management for good performance and smooth transitions by Epic Games' Support Engineer Axel Riffard goes over different methods to craft beautiful and highly optimized loading pipelines for your game, be it single or multi player.

Learn more about Unreal Engine at http://www.unrealengine.com

▶ Play video
dark edge
#

What happens when an actor goes out of relevancy range? Does it cease to exist or does it just quit being updated?

magic helm
dark edge
#

I'm working on a sub system that solves for hydraulic, electric, mechanical networks. Right now, my current thought is to have the components register themselves with the subsystem on begin play and deregister on end play. Should that auto magically play nice with relevancy?

#

The subsystem runs everywhere because I don't necessarily have the power networks replicated, just their end results and control inputs

#

And their topology graph

magic helm
#

Yeah that honestly should just work cleanly

#

Has anybody had an issue where turning off RPC events on an actor(when I say turn off, I mean I changed a Multicast event to no be replicated cause I wanted to switch it to the OnRep) will cause inherited OnRep functions to not work on client machines and only be called on the server?

#

But if I enable the event to be any sort of RPC, then the variable's OnRep works in the parent class...

#

And these two are independent of each other btw, the RPC does not affect anything that the OnRep uses...

vague fractal
#

Are OnRep methods which are taking the old object as parameter more expensive than OnRep methods which doesn't take the old object as parameter ?

magic helm
vagrant lance
#

Hi, I have an issue sometimes where a client will spawn into a lobby but fail to set their camera to one that already exists in the level. This only seems to happen occasionally. Any thoughts about what I might be doing wrong?

fossil merlin
#

Replicated audio - I'm perplexed. I have a MC that spawns a particle effect and sound for a simulated bullet hit. The particle replicates to all clients, the sound only to the owning client. Can anyone help point me in the right direction?

peak sentinel
#

PIE runs single instance of audio for each window

fossil merlin
#

I tried in PIE, stand alone, and even running the packaged game twice. I have a range on the sound so that I can get far enough away from each client so only the closest should hear it.

#

The only thing I haven't tried yet, is playing the game on two separate computers over LAN as I don't have a second rig handy at the moment.

#

I also have 'Create Audio Device for Every Player' checked

#

I have a grenade that gets thrown and explodes - that sound seems to work fine, and it's not rather through an custom events. Is it the custom events themselves that are killing the audio?

dark edge
#

replicate the fact that the bullet hit happened, then on each machine, decide what to do and do it

hollow bridge
#

Hi, if I change 2 replicated variable at the same time, is there a chance that at some point one of them will be updated and the other one not? Is there anything I can do to avoid that?

fossil merlin
dark edge
#

and in that event or actor, play the sound, spawn the particles, whatever

fossil merlin
#

It's being played from an event now, but I'll give the actor a try. Thanks.

fossil merlin
#

I'm an idiot - the audio HAS been playing the whole time, but the engine,m despite the checkmark, does not play audio in the BG from both windows when they are open. I have to shoot and quickly alt+tab to try and catch the tail end of it, but it's there..

#

I wish there was a better way to test it on a single machine..

kindred widget
#

@fossil merlinYou should make sure that if you're playing in PIE, that you have the checkbox set for each instance having it's own sound. And also consider adding this line to your project's default Engine.ini file.

[Audio]
UnfocusedVolumeMultiplier=1.0
#

@hollow bridge There is no promise that two properties will be replicated at the same time even if changed at the same time. If you need data to replicate at the same time, put it all in a Struct property and replicate that instead.

fossil merlin
#

I'll keep that in mind @kindred widget, thanks

hallow summit
#

Anyone up for a challenge? I have a spectator system, and i'm trying to make it so when the player dies that im spectating, it'll switch to a new a player, I can dm some pics of my code

dark edge
kind ember
#

Have anyone tried this in UE5?
What is the state of Network Prediction plugin on UE5?

hallow summit
dark edge
#

@hallow summithttps://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Blueprints/UserGuide/EventDispatcher/

Allows a Blueprint Class to report on its state to the Level Blueprint.

#

delegate is the c++ equivelent

weary saffron
#

Hey!
I found the problem.
Event with "Run on Server" does not work from the client.
I created an actor and put it on stage. Then I call the server event from the client

What am I doing wrong?

kind ember
thin stratus
#

Bit confused why the CMC doesn't override Jump Data when Correcting the Client.
I know that the Velocity is enough to override if you are jumping or not, but if the variables that control the CanJump() function aren't updated, wouldn't it cause the player to get wrong results from it?

#

E.g. what if I can Triple Jump and the Server corrects my Second jump due to whatever reason. If the Variables aren't changed, I would still be thinking, locally, that I did a Double Jump, stripping me of one of my jumps.

#

An easy reason for the Second Jump being corrected would be that the "bWantsToJump" package got dropped, making me predict my jump but the Server not execute it, correcting my location (quite heavily)

thin stratus
#

Lovely that UT suffered so much too..

fair lantern
#

hey guys, I have a problem. My replicated animation is playing twice on the client, how do I fix this? I'm really new btw xoxoxoxoxo

#

I want it to instantly play on the client as well, rather than having to wait to receive it from the server

#

I'm aware of the reason why it is happening but I don't know how to have one instance of the function on the client

thin stratus
#

Yeah needs some changes

#

The Multicast will always call on everyone when called on the Server

#

So you'll get a second call on owning Clients

#

You Multicast needs to filter Authority and Locally Controlled

#

Or maybe only Locally Controlled in your setup

#

I usually do this:

Event PrimaryAttack -> ExecuteAttack -> HasAuthority -> Multicast
-> DoesNotHaveAuthority -> IsLocallyControlled -> ServerRPC

Event ServerPrimaryAttack -> PrimaryAttack
Event MulticastPrimaryAttack -> DoesNotHaveAuthority and IsNotLocallyControlled -> PrimaryAttack

#

Server and Owning Client will thus call it via PrimaryAttack instantly. Then the replication happens. The Multicast is then only for Simulated Clients

fair lantern
#

like htis?

thin stratus
#

No, re-read my post please

#

You need 3 Events

#

One that is not replicated called Primary Attack

#

One that is a Multicast and one that is a Server RPC

#

The last two you have already

fair lantern
#

like that ye?

#

❤️

#

woops

#

nope thats not it im silly

#

das da one

short arrow
#

Clients appear to be unable to see other players ID from player states, Can anyone confirm whether or not this is the case?

woven sinew
#

Anyone know how to fix "Native NetSerialize StructProperty [...] HitResult failed." ? Owning actor's cull distance doesn't seem to have an effect

chrome bay
#

Possibly trying to serialize a hit result for a non-network addressable component or actor

#

E.g, the hit is against something local to that instance only.

woven sinew
#

it doesn't happen close to the level's origin though

#

same thing happens for "Native NetSerialize StructProperty /Script/Engine.PlayerController:ServerUpdateCamera:CamLoc"

chrome bay
#

Possibly trying to serialize a NAN vector?

tranquil eagle
#

How would you go about making a key-value struct that has FVariant values support replication? I assume that with setup like below changing Key would trigger replication but since Value is not UPROPERTY nothing would change upon modifying it?

USTRUCT()
struct FRPGAttribute
{
    GENERATED_BODY()

    UPROPERTY()
    int Key;

    FVariant Value;

    bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
    {
        Ar << Key;
        Ar << Value;
    
        bOutSuccess = true;
        return true;
    }
};

template<>
struct TStructOpsTypeTraits<FRPGAttribute> : public TStructOpsTypeTraitsBase2<FRPGAttribute>
{
    enum
    {
        WithNetSerializer = true
    };
};
meager spade
#

not sure that would work tbh

marble gazelle
#

(also don't know the FVariant struct, so no Idea, what its serialzation does^^)

meager spade
#

does the attribute really need to be FVariant tho?

#

i mean float should be fine for an attribute

#

and you can convert that to bool/int using simple conversions

marble gazelle
#

if you don't mine storing these values "somewhere" you also could use a template. or well depending on size maybe still a template but in a union or smth

meager spade
#

GAS's attributes are just floats

marble gazelle
#

yeah, more for general and not this specific use case^^

meager spade
#

but then again, what is an attribute in this context ?

tranquil eagle
#

I wanted to use FVariant to make a sort of generic system for attributes for RPG games that I could reuse for different games. That way I could have for example an array of attributes [Health: int, ArmorRating: float, ...] for one game and for other game a different array, but all that with one generic system like this. I wanted to make a small toy GAS, if you like 🙂

marble gazelle
#

make it a template 😛

#

is it that good?

#

xD

#

I see^^

tranquil eagle
# marble gazelle make it a template 😛

But if I make it a template I couldn't then declare TArray<FRPGAttribute> Arr and then somewhere else in code do Arr.Add({ AttributeTypes::Health, 100 }) and elsewhere Arr.Add({ AttributeTypes::ArmorRating, 5.5f }) because Arr would have to be declared like TArray<FRPGAttribute<int>> Arr for example and would only take ints, right?

marble gazelle
#

of course you can also play with raw memory if you want. sooo many possibilities :3

tranquil eagle
#

But some ints don't have float representation, won't I run into issues where I, say, assign Level attribute to 15 and it saves it as 14.99999999999 and have comparison/int conversion problems because of it later?

marble gazelle
#

they will for sure, if you know the type you have stored at a specific address replication is not an issue

tranquil eagle
#

That is good to know, I only remembered that not everything was represented. 😄 So you think it would be safer to just use GAS and just do all attributes as floats then? Maybe I could create some convenience functions to convert attributes from floats to enums and ints

marble gazelle
#

aside from that, Variants should work:
Variant types can be used to store a range of different built-in types, as well as user defined types. The values are internally serialized into a byte array, which means that only FArchive serializable types are supported at this time.

even if a bit overkill

#

and if serialization works internally I don't see a reason why replication shouldn't

twin juniper
#

Hi! Are WAN multiplayer games supported out of the box, or only LAN? It seems my server list is empty when playing over WAN, but when playing over LAN i can see the server

marble gazelle
#

No idea what you are doing, but if I run my server on my dedicated server I can connect to it without issue

twin juniper
#

i'm using blueprints

#

and not dedicated server

marble gazelle
#

well then you might need to forward some ports

twin juniper
#

😦

#

which and how?

marble gazelle
#

no idea^^

dark edge
#

@twin juniper Google it, but I remember UDP 7777-7779

twin juniper
#

but how do other games solve this issue?

dark edge
twin juniper
#

ah

dark edge
#

Like steam, Xbox, PSN, EOS, etc

#

It's very easy to test in WAN tho, just make sure the ports are forwarded to your server and you're in business.

tulip fern
#

Anyone have any idea why on the client in a listen server setup with 2 players, the client playerID is -1? Is there a good way to assign like a unified number to a player or am I missing something simple here? ControllerID doesn't seem to be the answer.

#

Basically I am trying to simply spawn the server player at spawn point 0 and client at spawn point 1. Figured I could easily just do it based off of controller ID but I seem to be missing something I think rather basic.

grim rain
#

hey guys i have a boolean in a function and the function works standalone but when i do it on client the boolean keeps returning false even though i set it to true inside the function. how do i fix this?

dull lance
#

For anyone that already knows this, if players are disconnected by the server (because say that the host ended the connection), what EndplayReason do they get?

LevelTransition/Destroyed?

Asking because I'm implementing a leave game early feature, so I just want to "punish" players that leave the game before the match ends; however, if the host leaves, I don't want to punish everyone.

meager spade
#

they dont get a end play message

#

well they do just the normal destroyed one

#

but the same one if they click quit

dull lance
#

Endplay does have a Quit Reason though... does it not apply?

#

I have custom leave logic if they leave through the game menu; just trying to also cover sudden app quitting

meager spade
#

hard to do really

#

most games have a buffer for X time allowed to rejoin

#

else they mark you as quitter

sharp furnace
#

Hi Guys, i have built a Server and trying to run it as a dedicated. However it just shuts down.
When i debug it it is stopping on this line

/**
     * Dereference operator returns a reference to the object this shared pointer points to
     *
     * @return  Reference to the object
     */
    FORCEINLINE typename FMakeReferenceTo<ObjectType>::Type operator*() const
    {
        check( IsValid() ); //-> SERVER FAILING AT THIS LINE Ln:1063
        return *Object;
    }

Any ideas -> Assertion failed: IsValid()

tender badger
#

MMO game company use the default Server&Networking in UE, or do they mostly build their own Server?

#

if built their own Server is better and popular, how to deal with the inside special declaration by UE, eg. in ACharacter
UPROPERTY(Replicated)
float ReplicatedServerLastTransformUpdateTimeStamp;
UPROPERTY(ReplicatedUsing=OnRep_ReplayLastTransformUpdateTimeStamp)
float ReplayLastTransformUpdateTimeStamp;

kindred widget
#

@tender badger Your question cannot be answered without the crucial information of what kind of game you're talking about. MMO is a vague term. So, yes and no.

tender badger
#

FPS

kindred widget
#

So like.. match based games like counterstrike or huge openworld game with hundreds of people in the same map?

tender badger
#

yep

#

so what's the main limitation of using the UE default server and networking?

#

ppl count cannot be too larger?

#

and how about VR game, which has less count of player, but more data, like the HMD & Hands are moving/rotating all the times.

dull lance
#

you'll hit a massive block at around 80 players, at which point you'll essentially need an engineering team just to optimize/handle that (push model, rep graph, etc). Your next block is at around 110-130 players... and to solve that, you essentially need millions of budget 🙂

kindred widget
#

Usually player count will be your problem. Each new player causes more and more computational requirements for the server, and usually at a larger scaling factor per player. IE, going from 60 to 61 players causes more stress on a server than going from 4 to 5. More and more relevancy to be considered etc.

dull lance
#

And let's not forget the more important elephant in the room before we start considering the engine's limitations :

#

Whether your systems are actually optimized / properly built for handling multiplayer frameworks

hallow summit
#

So the bottom part happens first and sets the player controller as a variable (spectated player controller). Then on the top when I try to use that variable it gives me an error that says accessed none on that variable. Anyone know why?

kindred widget
#

Where is the execution coming from?

hallow summit
#

in the character bp

#

the bottom happens first, then when another player dies it goes to the top (true)

kindred widget
#

You can absolutely confirm the top never happens first? Because if both of those are null, it'll still be true.

#

Also, your naming conventions are odd. You have a ServerRPC named HandleLocalDeath. Which is calling another ServerRPC. O.o

peak star
#

Has anyone here had success putting a dedicated server onto an amazon ec2 instance? I am trying to create a lambda function triggered by a Rest or http ApiGateway but the describeInstances function never seems to execute. I want to vaRest Inot that gateway in order to request a list of elastic IPs at which my servers reside.

#

And use the response to populate a list in UMG

hallow summit
hollow portal
#

are there any good tutorials on how to set up a server for ue4 and save/load data from & to that server ?

hallow summit
peak star
#

Or is there an easier or better way to list the ips of the instsnces?

Maybe for now I cam just hardcode it into the http response but I would like to let the player know the status of the servers and not list any that are down etc.

tender badger
#

Thanks. how about a VR FPS with less than 10 players

sharp furnace
#

Could this cause a dedicated server crash?

kind ember
# peak star Or is there an easier or better way to list the ips of the instsnces? Maybe for...
#

You can get ur ec2 id and public ip of it this way.

#

Have the ue4 server.exe update its status to a data table(I use dynamodb).
Make a lambda that loops through the table, this way you can give players list of servers and its status.

#

And don't ever hardcode the ip, the ip of the ec2 instance will change after shutdown.

woven sinew
#

Anyone know why my UObject is garbage collected even if I have a reference to it and I changed its outer so it's not destroyed when its old outer is ?

#

I might not have done one of these things correctly, maybe someone has some experience with this ?

bitter oriole
#

How do you know it's GC, and is the pointer from the referencing UObject UPROPERTY

woven sinew
#

I mean not GC, destroyed when outer is, it's in a TArray inside an ActorComp

#

when my Actor is destroyed, it also destroys the UObject, even though the UObject's outer is another actor

#

I rename the UObject on the server and multicast

bitter oriole
#

Does the other actor hold an UPROPERTY pointer to this UObject ?

#

I guess actors might actually destroy sub UObjects on destroy, anyway

woven sinew
#

yeah

#

the UObject is still referenced in CreateSubObjects

#

How do I remove if from there

bitter oriole
#

How did you create the object ?

woven sinew
#

NewObject in a comp of the actor

bitter oriole
#

Weird, I thought objects would only become subobjects when using the dedicated constructor syntax

woven sinew
#

that's in NewObject()

fossil veldt
#

Anybody know if there's any sort of debug views for rep graph? Particularly would be nice to view 2D Spatialization with some kinda chunking / lines and update rate / dormancy

chrome bay
#

Only thing I know of is AReplicationGraphDebugActor

woven sinew
#

I think I did everything you said but even though I change the item's outer it's destroyed with the previous outer

#

I mean I don't know if the UObject is destroyed but it's marked as pending kill

chrome bay
#

Not sure what you mean exactly, you're changing the outer at runtime?

peak star
chrome bay
#

I don't think that's particularly well supported tbh

woven sinew
#

how do you transfer uobjects between actors ?

chrome bay
#

Usually you don't

woven sinew
#

works fine for me besides the destroying part

chrome bay
#

You'll probably have the same issue trying to move an actor component to a different actor

woven sinew
#

I won't do that

peak star
chrome bay
woven sinew
#

I thought your tutorial implied you'd do transfers

chrome bay
#

I use actors for the actual items themselves, the UObjects are just slots in that tutorial which are fixed

woven sinew
#

so no game at all uses uobjects for multiplayer items ?

#

using actors doesn't sound optimal

chrome bay
#

Probably not AFAIK

woven sinew
#

you spawn them at 0,0,0 and then teleport ?

chrome bay
#

Well if anything it can be more optimal, it uses a channel, but you can control relevancy and update rate per-actor.

#

If you have an actor with lots of replicated child object, they will all replicate at the same time, at the actors' frequency

#

In every game I've done so far a weapon for e.g. has always been it's own independant actor

#

And inventory slots are either a simple struct/array or a fixed object

woven sinew
#

okay

violet sentinel
#

How can instigator be missing on clients on server-side spawned actors.
On server I have actors spawned (turrets) passing valid Owner (tower actor) and Instigator (player pawn) during deferred spawn, but on clients the Owner is valid but Instigator is null
instigators (player pawns ) replicated and exist on client

ATurretObject* Turret  = GetWorld()->SpawnActorDeferred<ATurretObject>(TurretClass, SpawnTM);
    if (Turret  )
    {
        Turret->SetOwner(TowerBase);
        Turret->SetInstigator(OwningPlayerPawn);
...
                Turret->FinishSpawning(SpawnTM);
        }

didn't seem to be different from

GetWorld()->SpawnActorDeferred<ATurretObject>(TurretClass, SpawnTM, TowerBase, OwningPlayerPawn);
stray crescent
#

Does anyone have a resource that properly explain the dedicated server pipeline?...

I'm working on a game that work similar to Valorant
where there are many players who split to different games

  1. How do I appreciate it?
  2. Do I need to run a a server for each game instance or only 1 game instance which will handle all of the games?
  3. Do I need to use sessions?
nimble parcelBOT
#

:clock2: Stryke#8490 was muted for 10 minutes.

meager spade
#

You need 1 dedicated server instance per game, you would likely use sessions yes. Beacons also.

#

Yes 1 session per game

#

party sessions != Game sessions

stray crescent
#

and game mode base already creating the session for me correct?

#

wait so the client connect to the server and then look for sessions, since the server start new game instance when there arent any available the client will find all of the sessions of all the instances

#

basically the sessions wont collide even if they are running from different game instances
right?

#

(btw i wasnt sure where to post this...)

meager spade
#

no

#

depending on your game, and OSS

#

you create a lobby (for you and your friends to join)

#

then again, depending on the game, you either show a list of servers or you search for a match

#

searching for a match will get the dedicated servers, check if there is space, etc, and put you in a game. If no server is found, it spools up a server or connects you to an empty server,ec

#

there is a lot involved.

stray crescent
#

by game instance i mean the dedicated server version thingy

#

all of those dedicated servers use the same ip as the server?

#

or do they need to run of separate servers

#

where each server run 1 dedicated server

meager spade
#

same server can run multiple instances on different ports

#

its up to your matchmaking system to handle that

stray crescent
#

and the matchmacking system isnt a part of unreal right?

#

or is it the session thing?..

fading birch
#

also depends on what CPU hardware your server is running, as it may experience a degradation in performance if you try to make the server instance handle too many of your game servers at once.

#

Some Online Subsystems have matchmaking, EOS does. Most of them don't afaik, I don't think Steam does. If you want scalability of your servers, to meet the player demand, then AWS Gamelift or PlayFab are your best out of the box options. PlayFab is much more suited for those not very familiar with the AWS ecosystem and AWS's documentation is written in a way that you should already understand how to use AWS.

stray crescent
#

I'm still confused as to how the matchmacking system knows what to do....