#multiplayer

1 messages · Page 207 of 1

plucky prawn
#

its an actor component that has the multicast so i should be able to do that, thanks

thin stratus
#

Yeah you can't stop a multicast so you gotta filter afterwards.

nova wasp
#

or you can use rpcs on an object already filtered per connection

#

netgroups etc

thin stratus
#

I also doubt if it's ultimately cheaper to have a specific actor for this stuff that has net relevant for overridden

#

Yeay same idea haha

#

Net groups are also a thing , right

queen escarp
#

hey i have this ui problem when i test in PIE as listen with 3+ clients or as only clients all works but after i build the game and try it it dosent work :/?

#

the functionallity works in the built game but the visual part dosent work :/??

#

ideas ?

balmy gazelle
#

If there is a manager in the world with a random seed that show or hide actors from a list (them all are placed in the level statically in the level editor), technically the only thing that need to be replicated is the seed from the manager and the event call to show or hide them, right ? (so don't need to replicte each actor visibility etc)

latent heart
#

Thsts 100% how not to get help.

twin juniper
latent heart
twin juniper
#

bruh why should i go there?

#

ooh

#

ok

#

ig

twin juniper
uncut relic
#

"zoning" networking question

Hello! I'm developing a top-down multiplayer game where there will be smaller "arena battles" between <10 people at a time. I have nailed down this basic multiplayer step already but I want to implement two new features:

  1. MMR - I will make a separate rest API server for this which will also handle login and stuff, maybe in combination with steam and other things. Any tips here are still appreciated but I will probably figure this out.
  2. In-between queueing for games I want people to be able to "zone" into a neutral safe-zone where they can interact with people and form groups. If there are too many players (maybe like 100) people will be zoned with players that are similar ranks to them or friends or friends of friends. I don't need help with the specifics like who is zoned with who but I need help with the general problem of "zoning".

Questions:

  1. How I can best achieve this "zoning"? I suspect that it should work similarly to how world of warcraft does "cross-realm raids".
  2. What is "zoning" like this called?
  3. How do I run multiple "game instances" (like lyra experiences) on a single server? Is that good practice?
latent heart
#

This is how ^

twin juniper
twin juniper
latent heart
#

When I grt home maybe.

woven bramble
#

What is the technical reason why the Server gets lower FPS than the Client? Is there any way to optimize this?

latent heart
#

It doesn't really. It just doesn't need to run at a higher fps in most cases. If you mean a dedicated server.

#

If you mean a listen server, it just has to handle extra stuff.

woven bramble
#

There is already an extra FPS problem in the game, and on the server, this FPS problem increases even more. And this is Listen Server unfortunately.

kindred widget
#

Feels more like sitting should be it's own animation blend state, I think? People in the animation channel would probably have better info on the best way to implement that in a scalable way.

But for the enum I recommend changing that to a GameplayTag. And if you're using GAS you don't even need a container. You can simply apply a GameplayEffect to the sitter with a tag specified. If the owner of the anim has that tag on their ability system component, sit. A montage could maybe override that and blend to the sitting mode and then the sitting state I assume.

uncut relic
# uncut relic # "zoning" networking question Hello! I'm developing a top-down multiplayer game...

I think I can reframe my problem a bit:

Let's say I run a dedicated server ("Server") and I have two clients, "A" & "B".

If B is in an e.g. Lyra Team Death-Match experience then A can obviously use the Main Menu experience before joining B's game.

Extending on this, it means we can have players be in totally different experiences at the same time on the same dedicated server instance.

How does transfering players between these experiences behave exactly?

Can we host a team death match game and a capture the flag game that works as expected at the same time with different players?

How does this scale? If we have 50 players in an experience and then host 100 of these experiences at the same time what would happen?

kindred widget
# uncut relic I think I can reframe my problem a bit: Let's say I run a dedicated server ("Se...

That's not quite how this works.

If the DedicatedServer is a DeathMatch, then that is what it is. B is just connected to it.

A has no correlation to B or the DedicatedServer at this point. It is running it's own thing until it connects to the DedicatedServer.

Similarly If you want to run dedicated servers for DM and CTF. Then you need two dedicated servers. One hosting DM, and one hosting CTF.

uncut relic
#

Oooh okay. That makes sense then. This narrows my problem down quite a bit.

uncut relic
kindred widget
#

I haven't personally handled setting up backends of that scale, so you'd have to poke at others. But hanging around long enough I would assume there's no premade solution. Usually that's custom territory based on the game as far as I know.

hoary spear
#

Which extends quite far by now lol

haughty ingot
# woven bramble What is the technical reason why the Server gets lower FPS than the Client? Is t...

The server is responsible for a lot of things that clients are not. Unreal’s default networking is simple, but being simple has a cost. Every frame the server calls UNetDriver::ServerReplicateActors and has to build a potentially large list of actors that are relevant to each connection. This can be an expensive process when there is a lot of replicated actors, then there’s the default property comparison logic of UPropertys that are flagged as replicated. The server will run a comparison of these properties to decide when there’s a delta that requires the property be packaged and sent. Not to mention all the extra stuff a server needs to do to maintain authority over specific actors, particularly movement. There are ways to optimize all of this, but that’s the gist of it.

real ridge
#

Guys I have weird problem I am throwing bombs which should do damage by hit but server call below is never called when i debug it when I debug upper call it is called but i dont get in server node never only client

#

any ideas ?

#

thus i cant do any damage then...

haughty ingot
#

A lot wrong there

#

But to start, did the server spawn this actor, and is the actor replicated?

vital barn
#

As the server, is it possible to retrive information via an interface? I want to retrieve what item a player is holding through an interface (GetPlayerCurrentlyHeldItem) but it always returns invalid :(

The interface runs on the player correctly from the server, but as mentioned previously returns null

#

The actor is set to replicate

haughty ingot
#

It’s possible, but the item it’s retrieving would need to have been updated to the server first. If the client is the one making changes to their “currently held item”, without notifying the server. How could the server ever retrieve the correct information?

vital barn
#

Ah, should I be doing this another way then maybe?

#

If you have any suggestions

haughty ingot
#

I don’t really give design suggestions, just know that if the client is making changes to their currently held item, they will need to tell the server what change they made. It’s as simple as sending a Server RPC when the client makes a change .

vital barn
#

Alright, thank you!

blazing spruce
#

Hi, I'm having an issue with setting clients rotation after they interact with a draw to face the draw, it sets their location no problem but doesn't do the rotation.. the weird thing is that if I exit the draw then re-enter it.. it works? that doesn't make any sense to me lol surely is the exact same code running when I opened the draw the first time, what could make the second time any different? Any ideas what could be causing this? Also, that ClientSetRotation event is being called every time the client opens the draw

real ridge
haughty ingot
#

Unless you’re only setting Hit events explicitly on the clients, the server will fire the hit event themselves. You don’t need an RPC to apply damage. You can either turn off the hit events on clients and only enable it for authority, or you can filter out the other connections before applying your damage. You also are using GetOwner, and that assumes you’ve already set the owner to be a client, but every other client that executes this hit event will just drop that RPC because clients can’t call RPCs on actors they don’t own.

real ridge
#

is that wrong way?

haughty ingot
#

The server already knows who the owner is.

#

Still don’t need an RPC

real ridge
haughty ingot
#

Use a Switch Has Authority before the cast.

real ridge
#

why and for what node authority?

haughty ingot
#

Huh

real ridge
#

i mean like this

#

😄

#

but why to not run client side?

haughty ingot
#

Hover over the Apply Damage node…

#

Read the tooltip

real ridge
#

authority only

#

😄

real ridge
#

maybe bombs are spawned incorrectly

#

they are spawned and attached below plane

haughty ingot
#

Post pictures

real ridge
#

of spawn ?

#

i have 6 bombs in row this is how is first spawned, event is called after begin play

sinful tree
#

Is your BP Proximity Fuse Night Witch blueprint marked as replicated?

#

And also, you probably don't want to multicast a spawn as that ends up creating seperate copies on every machine.

real ridge
#

when I dont use multicast i dont see bombs on client only on listen server :/

sinful tree
#

If you use a multicast you're creating separate actors on every machine.

#

There's no networking separate actors like that.

#

If you spawn a replicated actor on the server, then that actor can be replicated to clients.

real ridge
#

So how i should spawn it via event on client or server event?

sinful tree
#

If you're trying to have a client request the creation of such an actor, you'd normally do something like Input > RPC To Server > Server Spawns Actor

real ridge
#

just this but then it is not visible on client 😄

sinful tree
#

Is BP Night Witch something that the player possesses or is an owner of?

real ridge
#

its posseses by player I am playing with it

#

its plane

#

its child actor of main actor divided to characters which are playable

pure siren
#

I am making a mod for lockdown protocol game. I wrote such a code, but only the server can be invisible and everyone sees it. the client cannot be invisible at all. what I want is that the client can also be invisible. how should I do this?

sinful tree
# real ridge its posseses by player I am playing with it

Ok, so if it is player controlled, and you're RPCing to the server on the BP Night Witch, then certainly the server is spawning it. So long as it is marked as replicated, then a replicated copy of the BP Proximity Fuse Night Witch will be spawned on clients. That's how replicated actors works. There may be something else interfering with the BP Proximity Fuse Night Witch that could be destroying it. You can verify that they are being created by putting a print string on begin play of the BP Proximity Fuse Night Witch and you should see prints for the server and any clients.

sinful tree
real ridge
#

attach actor on actor is propably not correct to call on this RPC server call

real ridge
#

i should use authority node from begin play to call server call nah?

#

now correct

#

2

sinful tree
#

Well begin play fires on both client and server. if you're calling an RPC on begin play, you're probably going about what you're trying to do wrong as you shouldn't need your clients trying to tell the server to spawn something on the plane, and because begin play fires on the server already, it wouldn't need the clients to tell the server to do it.

real ridge
#

😄

#

did it like this

sinful tree
#

Yes, but do you also need to have that spawning as an RPC? That RPC can be called at any time in the future by a client.

real ridge
sinful tree
#

But do you need the clients to tell the server to spawn the bombs? The server can just as easily keep track of how many bombs are remaining and the delay to respawn them without the client telling the server to do it.

real ridge
#

I have this for bomb throwing , and when last bomb is away it will count delay and call spawn idk I think its client job

#

prove me wrong

#

anyways I still need find out why they are not attached to wings 😄

#

but in air behind plane

sinful tree
#

Inputs only happen on the client. You have a client changing replicated variables locally.

real ridge
#

i will deal with this later now I need get that spawned bombs on server event to be atttached to wings

#

now they are staying behind plane rip

#

omg i clicked replicated movement and its kinda wierd

#

weird

#

when i play listen server its ok.. 😄

pure siren
sinful tree
sinful tree
# pure siren Do you have any idea how I can make him invisible?

You're using the correct node to change the visibility of something, but I don't know enough about the game you're trying to mod and what you have access to in order to modify a specific actor.
In order to call a server RPC, the client must own the actor you're calling the RPC on.

woeful wagon
#

hello Im on eps four of the multiplayer tutorial but when I hit Host Session it doesnt take me to the level ive selected https://www.youtube.com/watch?v=oUxSdX6SxvQ&list=PL6AQiNvVMdLuvzE2nT_S2brtsBC2c8lNt&index=4 the steam overlay does pop up which is strange that I cant host?
Any help would be awesome!

In this series we are setting up the connections for online multiplayer using the base Steam sessions that come with UE4.

In Part 4 we connect our game to Steam and connect our players together.

SUPPORT ME
Patreon I https://www.patreon.com/ryanlaley
Buy Me a Coffee I buymeacoffee.com/RyanLaley
Donations I paypal.me/ryanlaley

PRIVATE 1-2-1 SE...

▶ Play video
true karma
#

can a pawn have an owner if it's not possessed?

trim thunder
trim thunder
woven bramble
#

For a good gaming experience, does it make sense to use Unreal's Default Steam system or SteamSocket?
I would be grateful if anyone who has published a game on Steam before could answer me.

sinful tree
woeful wagon
kindred widget
true karma
kindred widget
#

Probably but it it's not normal. I did this in our latest project, but it wasn't because of lack of possession. But because they were AI and I needed a player to own them instead of their AI controller.

If you don't need possession, usually you don't need a Pawn either.

daring gorge
#

does gamemode allow for map usage since its server only and i wouldnt need to replicate anything?

sinful tree
daring gorge
#

yeah so lets say i use it to do stuff in gamemode, that stuff will still be replicated to the clients right? since gamemode is server only

sinful tree
#

But that's not what matters. You use a variable type for what your needs are, not because they can or cannot replicate, nor does it matter what class it is in.

#

And no, anything in the game mode is not replicated to clients.

#

Any code that executes in the game mode that calls replicated functions in replicated actors or components can be replicated to clients.

daring gorge
#

oh

#

but isnt gamemode the server class and server the truth in terms of multiplayer?

#

so supposedly lets say if i spawn an actor through gamemode shouldnt the clients see it too?

errant charm
#

Hey, I'm sure you get asked this question asked a lot, but I'm super unsure how to fix this after reading on the forums.

A widget calls this Update Name event when a button is pressed, it works on the server but doesn't seem to work at all on the client. This is what the blueprint looks like... not sure why as this seems to be super straight forward

sinful tree
sinful tree
errant charm
#

ahh ok, so what could i do to fix that ?

sinful tree
#

You have to call Run on Server event on something that the client owns, and then when running on the server you can call to execute code on the desired actor.

daring gorge
sinful tree
#

The game mode can control something else that replicates that data, like setting the variable on the gamestate, or you can have some other replicated actor that contains that seed.

daring gorge
#

yeah i have a replicated actor and it does contain the seed, im using gamemode to spawn that actor

#

with the seed

daring gorge
sinful tree
#

Again, would need to be on a replicated actor of some kind, whether GameState or some other.

daring gorge
#

thank you again!

errant charm
sinful tree
# errant charm Ah ok I see, yeah, just did it on the player pawn. It worked, but I don't want t...

Yes, but that in a sense would require you to be able to have the client request to own it which would still require that RPC.
You probably want to implement a more generic interaction system that allows the client to request to the server they want to do something to any actor, and then have the server call an interface on the desired actor which can then perform the requested interaction, or utilize a component to communicate to the actor.

errant charm
real ridge
#

Guys I have spawned actor via RPC but still event hit and overlap is executed only on client side when I debug it any tips?

modest crater
#

Have you guys seen this? (Yes I know another unreal Dear imgui plugin but its the remote drawing that I am talking about)

https://github.com/VesCodes/ImGui

I was going to implement some debugging widget stuff with slate until I hit a road block with no FSlateApplication drawing or anything happening on a server, this implementation with imgui however is actually crazy useful for debugging (at least for my uses, I implemented the library today and have everything running well, I can have N clients and a dedicated server debug imgui window drawing their own stat and information, helps me visualize any data that's off (atm I am implementing a weapon system so lots of little side affects in a network context like mismatched ammo counts, equipped slots etc)

Anyway just wanted to share because I had no idea about the existence of NetImGui Server and how its implemented here

#

(A dedicated PIE with 2 clients) This is more or less the end result (minus the bad bareboneness, still only just setting it up) where you have the server in orange and the two clients in blue, each displays their own instances stats and I can manipulate and interact between them all

#

I haven't tested it outside my own local machine but I would assume this also works for VPS's and whatever else you host stuff on (it says people use it for embedded device stuff too like switch and mobile)

kindred widget
#

When you hard travel everything related to worlds are destroyed. Any Actors of any kinds go kapoof. All UMG widgets are removed from the viewport.

On arrival, the login process begins which leads to a server telling client to create specific gameplay actors. See PostLogin. Specifically...

AGameModeBase::PostLogin -> GenericPlayerInitialization(NewPlayer);
AGameModeBase::GenericPlayerInitialization -> InitializeHUDForPlayer(PC);
AGameModeBase::InitializeHUDForPlayer_Implementation -> NewPlayer->ClientSetHUD(HUDClass);

#

Client has no GameMode. So I'm not sure what you mean here?

#

Right. This never runs on a client. It'll be Server only.

#

Client doesn't have a GameMode.

#
/** Set the client's class of HUD and spawns a new instance of it. If there was already a HUD active, it is destroyed. */
UFUNCTION(BlueprintCallable, Category="HUD", Reliable, Client)
ENGINE_API void ClientSetHUD(TSubclassOf<AHUD> NewHUDClass);```
#

Client has no GameMode.

#

If you have a GameMode on a machine, then it isn't a client at that moment.

#

If you start the game, you should start in a main menu. At this point your application is standalone. You are the "server". You are not a client.

When you connect to another machine, regardless of whether it is a dedicated server or another player hosting as listenserver, your application become a client.

When you host a game as either a listenserver or run a Dedidcated Server instance, that application is Server.

#

Following the above, when you are a client. You can never have a GameMode.

#

I'm not sure if you are wanting it to start from the main menu. If you're wanting to test directly in a gameplay map then you just set the checkbox for it.

#

You need to start on the MainMenu map. Your DedicatedServer will probably need to have an OpenLevel hack or something. Unless there is a better way to do that, I'm not personally familiar with setting those up yet, just the overall idea. But that should drop your PIE instances into the main menu. Then you can do "Open 127.0.0.1" to connect to the dedicated server instance once it opens it's level.

#

Has nothing to do with GameMode

#

Most people maintain widgets inside of the AHUD class.

#

One is spawned per player, only on their local machine.

#

It does.

#

You always have a GameMode. This will just use the project default. If that isn't set it'll use GameModeBase I think.

#

Are you building on Lyra?

#

This is why I said to look at that function callstack. Clients do not have a GameMode. They are told to create classes from the server. Server has a GameMode. Server says "Hey, spawn this HUD class", which it pulls from it's own GameMode

#

I'm not sure how GameInstance is connected here? But no.

#

There are some pinned blogs on multiplayer structure. Source code also.

marble gazelle
#

well load a level instead of connecting to a server should give you a game mode locally. We created a special game mode for our lobby.

#

well only if you are connected to a server, otherwise you have a GM but not a full fledged game experience as you don't (shouldn't have) server code on the client side

dark parcel
#

"client" isn't really a client until it connect to a server.

#

What I mean by connect to a server is connecting to an instance that is running an unreal game.

#

Playfab or backend service are entirely another thing

#

Post login in game mode is called on server when a client join. Got nothing to do with user login, e.g google, steam play fab, you name it

#

I think learning multiplayer game from youtube is kinda wishful. I'm on my first game and I won't bother with data base and all that stuff.

#

I'm using steam and keeping it simple

woeful ferry
#

Learning UE from youtube in general

#

is wishful thinking

#

99% is just follow me but I will not explain why I'm doing it

fresh orchid
#

Hi all, me and my friend are currently learning game development in UE5, we are watching tutorials and have bought a couple courses but all of them lack much detail on multiplayer functionality, we are looking to create a game with dedicated servers so people can host their own servers and have their sessions/player data etc logged on said servers, any pointers/guidance would be appreciated! any docs or guides/courses would also be great.

marble gazelle
latent heart
#

Make pong. If you survive, do something more complex.

marble gazelle
# fresh orchid i like the challenge 😉

I also like the challenge and 6 years ago I started to make a MMOish self hosted game. Our backend worked etc. but we didn't have the ppl to actually create enough content. now we do single player and that was the best decision taken on the porject.

fresh orchid
woeful ferry
#

do a singleplayer game like the rest said

fresh orchid
#

so many boomers here

kindred widget
#

Networking, at it's core, is easy and simple.

If you need something on all clients and it needs to do something. Then it needs to be replicated. If it has state, that needs to be replicated within it. Replicated things are spawned only on server.

You can only RPC through replicated actors and with certain ownership conditions. You use Server RPCs to set state or Client RPCs to tell clients to do things directly. Do not use Multicasts until you fully understand replication.

Past this. It's just the constant battle of using the most basic data you can to replicate, and infer as much as you can on the client to set stuff up correctly. And doing so in a friendly way so that it doesn't look bad.

fresh orchid
woeful ferry
# fresh orchid so many boomers here

We don't doubt your capabilities and like Daekesh said, good job on what you have achieved so far!

But why we say you shouldn't be too ambitious about your first project is learning game development / unreal at the same time you're building a big multiplayer game, will tax your inspiration to keep the momentum

#

that's my two cents

#

I've seen too many people starting a MP project as their first, and stop working on it after a few weeks/months. If you want to learn to code or game dev in general, it can't feel like a burden

latent heart
#

Are you learning c++ at the same time?

#

For the trifecta.

fresh orchid
latent heart
#

Don't use multicast. Ever. Until you know exactly why you need it over regular replication.

fresh orchid
fresh orchid
latent heart
#

I mean learning c++ itself from scratch.

#

(no previous exp)

woeful ferry
fresh orchid
modest crater
latent heart
fresh orchid
latent heart
#

Lol there was nothing for ue at that time.

#

I don't even remember how I learnt cpp tbh.

#

Umg didn't even exist. 😦

kindred widget
#

I learned C++ on a whim because it was becoming clear that nativization was getting shitcanned and had too many random bugs. And that BP was not going to work for any scalable project. Was also learning networking at the time as well. No regrets.

latent heart
#

It's a fantastic tool.

#

And there were no slate docs. So I wrote my own version for fun.

fresh orchid
latent heart
kindred widget
#

BP function libraries were what started it for me. Still a great way to learn C++ in Unreal because it forces you to learn a lot of the macros and specifiers.

fresh orchid
#

tbh my only experience so far with c++ is adding custom variables into GUS 🤣 but hey im trying to expand my knowledge in each subject

fresh orchid
latent heart
#

Learn Slate if you want a bright future migraine.

fresh orchid
#

what is slate if you don't mind me asking?

latent heart
#

The c++ ui framework that backs umg.

fresh orchid
#

okay noted, thank you guys for the recommendations, this gives me stuff to do instead of sitting twiddling my thumbs lol

kindred widget
#

Realistically you don't need to care about Slate past input handling unless you plan on doing editor extensions. UMG can fill pretty much all gameplay UI needs.

latent heart
#

Yeah. Though it can be useful to create umg base classes for easier c++ integration.

kindred widget
#

Even then, you mostly make C++ classes to do minor or easier things in that widget for itself. Never tie your C++ gameplay code to your widgets.

empty glade
#

Hey guys, I'm working on a basic MP, steam-only game. It's a BP-project using the Advanced Sessions Plugin. I've run into a strange problem when clients join lobbies.

If my game mode extends GameModeBase, clients join and are correctly assigned the default pawn. The server can also call ServerTravel and everything works as expected—server and clients travel to the new map.

If my game mode extends GameMode, however, joining clients aren't given a pawn at all. When the server calls ServerTravel, nothing happens. The server and clients don't change maps.

Is this expected behavior?

#

I can force a pawn to be spawned and possessed using HandleStartingNewPlayer, I just thought it was odd that I'd have to do that with GameMode but not GameModeBase.

I'm still confused by ServerTravel not working at all though. From what I've read GameMode is supposed to have more multiplayer functionality built-in

kindred widget
empty glade
kindred widget
#

Could check your match state at servertravel time. This is the only change GameMode would do over GameModeBase.

bool AGameMode::CanServerTravel(const FString& URL, bool bAbsolute)
{
    if (!Super::CanServerTravel(URL, bAbsolute))
    {
        return false;
    }

    // Check for an error in the server's connection
    if (GetMatchState() == MatchState::Aborted)
    {
        UE_LOG(LogGameMode, Log, TEXT("Not traveling because of network error"));
        return false;
    }

    return true;
}```
#

Not seeing anywhere that state is set to Aborted other than a disconnect though.

empty glade
#

Unfortunately it's a BP-only project. I don't get any errors in my console though

#

oh wait - I do get "LogGameMode: Not traveling because of network error" after all. Hrm

empty glade
#

Well this is interesting. If I run in PIE, match state goes from InProgress to Aborted almost immediately. In Standalone it doesn't go to Aborted. This thread: https://forums.unrealengine.com/t/4-14-servertravel-with-more-than-the-server-doesnt-work-in-pie/376392/18 has more info on the issue. Dang PIE

UPDATE: I was able to figure it out. In my Editor Preferences, I needed to set Play Net Mode to Play As Client. Something about starting off with a server and clients auto-joining made GameMode immediately abort, which quietly broke a lot of things. Now, builds, standalone, and PIE all behave the same way.

Epic Developer Community Forums

Bug still present in 2024 (ue version 5.4.1), lol, seems part of greater problem with server-client communication in editor. Dedicated server and client has multiple problems in editor. Basicly, y still will be kicked out in pie if you connect to server. Join session not in pie but standalone or open level, open command, result to “do no...

marble gazelle
#

eh - no

hushed sierra
marble gazelle
#

Shruggo fine with me tbh.

vivid seal
hushed sierra
# vivid seal iirc, you now need to manually add and remove replicated subobjects when you add...

Thanks! For anyone else who has this problem, I missed 3 steps:
The replicating actor needed the flag set

AMyActor::AMyActor()
{
    bReplicateUsingRegisteredSubObjectList = true;
}

and the UObject needed to override:

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

Then I added a function for adding to the uobject array:

void AMyActor::AddUbjectToReplicatedArray(UObject* NewObject)
{
    UObjectArray.AddUnique(NewObject);
    AddReplicatedSubObject(NewObject);
}
shy hill
#

Hi, currently working on 5.1, using Steam advanced sessions, and struggling to solve a damn Ping issue.

If I don't use Steam sockets, I'm not able to return the ping when browsing for sessions (ping always shows at '9999'), if I use Steam sockets, I'm able to see the correct ping, but then the clients can't join any sessions, i've spent 2 days looking for solutions without success, it seems that I either have to upgrade my project to 5.4 (which fix the bug with steam sockets), or build my project from source, which seems like an overkill for just a ping issue.

Did someone manage to make steam sockets work with 5.1, or maybe there is a work around I haven't though of? Thanks for your help

halcyon elk
#

here what i am doing ,
in the editor i setup with 3 new windows clients and a dedicated server
i create a server in one of them with advanced session plugin
then in the two others i find and join the session .

in my custom c++ playerstate i have this code to get the unique id

FString AMyPlayerState::GetUniquePSID() const { if (GetUniqueId().IsValid()) { return GetUniqueId()->ToString(); } return FString("Invalid ID"); }

GetUniqueId() is a function of the base playerstate .

now with umg i show the GetUniquePSID but for some reason is the same for all clients
however when i retrieve the playerarray from the gamestate and get the corresponding GetUniquePSID of each playerstate they are differents .

any idea on what's going on, i am fighting with this problem for few days now .

willow vector
#

Anyone have a good resource (vid / doc / tutorial etc) for creating a team resource system? Ie, Team 1 gets "10 resources" every X minutes and then any player on that team can "spend" those resources

pearl narwhal
willow vector
pearl narwhal
#

You will just create a replicated variable as your team resource and use a RepNotify to replicate it to all the team player clients

#

And when someone wants to use a resource you will send an rpc to the server telling it that user X from team Y used resource Z and just decrement the amount

#

It should be very easy to implement takes like a couple of hours

pearl narwhal
#

This is a gameplay specific mechanic

#

So you won’t find other games implementing it this not very popular so isn’t worth to make a tutorial about it

willow vector
pearl narwhal
#

And if a player wanted to use a resource he will send a RPC to the server telling it that he used the resource and to decrement it

#

And once the server changes the value of the resource on it it will be replicated to other players as well

#

I recommend you reading more about the gameplay framework and the RPC system

#

You can dm me if you want more help

willow vector
#

Gotcha. I'll look into that stuff. Appreciate it. I just started like a week ago but instead of just following tutorials I'm also trying to do a side project to learn. Even at a small basic scale I'm seeing gaps

willow vector
pearl narwhal
willow vector
#

I actually have his C++ course

pearl narwhal
#

YouTube tutorials can vary in their content quality/ a lot of them give bad advice

pearl narwhal
#

There’s another one for multiplayer games

#

Should help you get a better understanding about replication and rpcs

willow vector
#

Yeah I have zero programming knowledge so discovering BPs has been a life saver

#

BPs make sense

pearl narwhal
#

Anyways good luck !

willow vector
#

Thanks! Appreciate the help

ruby lodge
#

Why is this replicated variable not changing for the client?

#

I am setting it on the gamestate with an event only the server calls (LoadMode here)

#

and he calls it

#

for the server, the value of the variable is changed. For the client, it's not, although it's replicated

#

usually I know, when a variable is replicated and is changed, it changes for everyone

cursive steeple
ruby lodge
#

Oh, ROOKIE MISTAKE DAM

#

no it's not

#

thank you

cursive steeple
#

🍻

daring gorge
#

what is always relevant"?

dark parcel
#

Everytime the net update it will filter the actors to update based on the actors frequency (how often the actor should update). Then afterward it will filter the actors if they are relevant or not.

Actors that are not relevant will not be send update / replicated.

E.g. when actors too far away, it can be set to not be relevant, thus the server can save bandwidth by not updating irrelevant actor.

Look into actor relevancy in the pinned section.

#

Always relevant probably means that it will always pass the filter. Though I haven't use one my self.

daring gorge
#

i see i see, i believe this is probably useful for players that walk around the map?

dark parcel
#

Many possibilities, designer choice.

#

Common usage maybe actors that are soo far away or not in anyone view

#

If they don't need to be updated then you can save bandwidth by not making them relevant

daring gorge
#

i see i see

#

i was trying to spawn an actor using gamestate, however gamemode to request the gamestate to do so, weirdly marking always relevant on the spawned actor makes it spawn on clients and if unmarked it doesnt, i do believe i dont need to tick it on but it got me curious

dark parcel
#

Wdym by game mode to request game state

#

Game mode only exist on server

#

If you want client to spawn replicated actor, the player has to send server rpc

#

Server rpc = hey server please do this function in your machine

daring gorge
#

i want the server to spawn a replicated actor

dark parcel
#

Ok but you can't get game mode as client if that's what you are doing.

daring gorge
#

no im calculating positions and setting up the actual gamemode in gamemode and sending that data via an interface to the gamestate which calls a server event to spawn in the actors with the info

dark parcel
#

I don't know if you need interface here

#

Sounds like misuse of interface

#

Anyway the basic is, if server. Spawn away.

If client, run a server rpc that spawn the replicated actor

daring gorge
#

game state is ?

dark parcel
#

What about game state

daring gorge
#

im calling the server rpc on gamestate yet the actor doesnt spawn on clients

#

i know i cant use gamemode because its server only

dark parcel
#

Clients don't own game state afaik

#

They should just read and receive update from server

#

Have you read into ownership?

#

If not then you seems to be lacking a lot of important bits in multiplayer basic

daring gorge
#

i did but i get more and more confused with all the different methods that i come across

dark parcel
#

Pinned section got those covered

daring gorge
#

ill look more into it ig

dark parcel
#

By default client only owns their controller and character/pawn

#

So you need to route server rpc in either of those 2

#

You can set ownership to client but that has to be granted by server

#

Client cant make rpc calls on actor it doesn't own

daring gorge
#

im trying to use pcg and spawn in lets say monuments, i dont think controller is the right class?

#

atleast because this is like lets say level setup

#

for now im trying to spawn in these monuments at the positions

dark parcel
#

You can only use rpcs on actors the player own, period

#

Doing otherwise will just drop the rpc call

#

Repeating my self here but you can grant ownership to client from the server but I don't think people end up doing that anyway.

#

Prob just have a component in the controller class that does things

#

Also generating stuff sounds like something the server should do then replicate to client.

daring gorge
#

yeah thats exactly what i was thinking about, i want this to be done by the server, however i think i should first read into pinned and compendium before i implement it

dark parcel
#
Epic Developer Community Forums

Clients can only do “Run on Server” RPC’s from Actors that the Client already own. The Server owns the GameState therefore you can’t make any use of “Run on Server” events. The GameState should only be used in conjunction with the GameMode class to replicate variables or make Multicast RPC’s to the clients. GameMode is used for server interna...

daring gorge
#

oh

#

"The Server owns the GameState therefore you can’t make any use of “Run on Server” events."

#

this is exactly what i was confused about

#

what owns the gamestate

dark parcel
#

@daring gorge

daring gorge
#

yes?

dark parcel
#

Was mentioning for the link but phone lagged out

daring gorge
#

thank you! the literal second line cleared up my confusion

#

also another thing that got me more tangled up was how different classes were shared, i remember an image i once saw vividly where gamestate was client and server and thought i could use state however now its clear

dark parcel
#

Why do the client have a say on how pcg are spawned btw?

#

I mean it varies by design

#

But I would thought server should be the one that tell it self to generate

#

Clients don't even need to do any logic, it simply receives the replicated actor

daring gorge
#

the client doesnt have a say at all, what confused me was why my actor wasnt spawning for clients but for server only

dark parcel
#

Is your actor marked as replicated?

daring gorge
#

it is indeed

dark parcel
#

Yea then there's no need for server rpc at all

#

Not to mention in multiplayer context

#

Good luck though, hope you figured it out

daring gorge
#

even a normal actor, my mistake was using a server rpc on gamestate

dark parcel
#

Well if it is generated stuff you don't need to do server rpc at all

#

Server just spawn it. Client just receive.

#

No need for any rpc

daring gorge
#

yeah, i think im not getting my doubt across well because i was more confused on which class to use to actually spawn something for the level

dark parcel
#

You can have a manager that only exist on server

#

The client doesn't need to know anything about it

#

Client simply gets the replicated actor

#

While server does it random generation, determine location and spawn the actor

#

If server spawn and the actor is marked as replicated. Client will eventually get a copy

daring gorge
#

so i shouldnt mark the replicated property for it to be server only if im right?

dark parcel
#

Only thing that needs to be marked as replicated is the actor you are spawning.

daring gorge
#

right, that makes sense

#

thank you so much! i appreciate your time and information, helped a lot

dark parcel
#

All the best

daring gorge
#

thanks!

vapid gazelle
#

Does it ever make sense for me to check if I'm the server or the client before making a server RPC call if UE is ultimately smart enough to figure out the context of where that RPC is being called for? It looks like I could save myself a Branch node.

From ChatGPT (which I assume could be wrong, I'm curious if folks here would correct it):

Server RPCs (Server keyword in UFUNCTION) are designed to be called by a client and executed on the server. However, when the server calls a server RPC on itself, the engine still follows the RPC mechanism, but with a key difference: it recognizes that the server is both the caller and the receiver.
The server will internally process the call, but Unreal Engine will bypass the network transmission step because there’s no need to send the data over the network when the server is calling itself.

modest crater
# vapid gazelle Does it ever make sense for me to check if I'm the server or the client before m...

That is true. An RPC does not send if its already in the context its needs to execute, when you trigger an RPC it will call ProcessEvent which long story short builds up some flags and then here decides if its a remote/absorbed or local function,

  • Remote being an RPC
  • Absorbed meaning do nothing, think of a client called a NetMulticast RPC
  • Local means we are already in the context, we can execute it locally

btw this stuff can be figured out yourself rather than relying on guess work from an LLM, just saying

vapid gazelle
modest crater
#

On a client, this is where it ends up.

modest crater
modest crater
vapid gazelle
#

Interesting just how many of these there are

modest crater
#

Different objects are used in different contexts and need to get their space relative to that

cunning mesa
#

Hi all -- I am moving a non-character actor on the server, and the movement on the client is jittery. I've solved this on actors before by doing client side prediction of the movement and handling the replication of a location and lerping to it if it's over a threshold distance away.

Are there any built-in tools to help me do this? It seems like a common thing for replicated actors and I'm hoping there's an easier way for me to implement this.

Thanks!

thin stratus
#

But I wouldn't suggest using it for production yet. Probably a 2-3 engine versions too early

cunning mesa
#

Thanks! I'll re-implement the local prediction and lerping then.

thin stratus
#

Time

silent valley
#

There's an option to uncheck Run in Single Process

marble gazelle
#

just don't run it under a single porcess as noggs stated (better anyway) you don't need to package anything for this.

#

Shruggo never tried, maybe? I used the same classes, and branchend (for editor, ifdef for package) server/client code

#

if / else

#

(though maybe the engine brings smth build in to split classes for server / client) but if not, you could also put your logic in some sub classes you instantiate from your game instance based on the target (simple GI Subsystem with instantiate subsystem only for client/server would also work)

#

hm your nodes could just do nothing on client / server but I didn't do crucial logic in BP

#

ifdef doesn't work in editor as you compile for the same target, so it was some combination using macro magic

prisma osprey
#

Hey man sorry for the late reply, I wrote you a big message then my internet went offline, it came back on by yesterday, an unexpected offline week... lucky me I have some offline stuff about learning blueprints to get me busy.
Thanks for your help, I guess I'll stick with BP only for now, focusing more on the gameplay.
The thing with UE, Blender... is that we just need 72 hrs x day, leaving 24 for real life. About that I guess you need to do something you like without caring too much about the market, even if that means working on an open world map who I agree it can take forever, but at the end you'll feel happy cause you had fun doing things you like, even with some headaches 🙂 I'm too working on only one project, the others are just prototypes I made for not losing the ideas, I saved them for a future reference.
Thanks again for the insights, It's my first year with UE, and previously I only used AGS for few months, and I had a lot of fun making 2d point&click games, still missing it to be fair... I had a .TXT file on desktop with all C# stuff I was learning during the journey 🙂
Feel free to DM me if you feel stuck on ideas for your game, I lack coding skills but sometimes I still have some good ideas, I have a sailing ship too (not a pirate one, just a ferry)
Thanks for the video, looks funny and interesting 🙂

grizzled garnet
#

What's the best way to identify a player persistently and replicated? What I'm trying to do is store scoring info for the player, like their name and points, such that it's still visible after they disconnect, and when they reconnect they are set back to their points, something that can be traced back to the player state so that for example they can see their score.. Currently it's using the player state itself but that would be destroyed if the player disconnects and I'm currently getting other (de)referencing issues.

fiery wadi
#

Hi, Can someone tell me why my clients are 1 number behind ie... They are displaying the server's previous number instead of the current one.

#

I am incredibly new to multiplayer so still trying to wrap my head around it. xD

#

My thinking is that if the server (ie... the authority changes a replicated variable value that value is passed on to the clients automatically ? (The true and the false is what to do if a client)

dark edge
#

but you can always save

grizzled garnet
#

Didn't quite think of saving/copying, I'll look into it thx

dark edge
#

use an OnRep instead of a timer, the timer should run on authority only.

Authority:
Beginplay -> Timer -> change variable

Everyone:
OnRep -> Change Display

#

You have a timer running on every machine, and the ONLY time your text render is updated is when that timer fires. This is the a race condition like 3 different ways.

grizzled garnet
# fiery wadi My thinking is that if the server (ie... the authority changes a replicated vari...

Actually one thing I've noticed that might be related, while replicated values do replicate to clients, if they're constantly replicating it might be too much data and you could notice the value stuttering. I was making a timer client-side and found this issue, though a simple workaround was to use an unreplicated client timer then update it with the replicated value as needed, like every second or when a state would alter the timer differently than the tick

fiery wadi
#

@dark edge Ok thank you !

#

You was right adding a RepNotify and disconnecting the "client" now puts the number in sync with the server.

dark edge
#

@fiery wadihttps://www.youtube.com/watch?v=JOJP0CvpB8w&t=802s

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

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

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

▶ Play video
#

Key word is eventually

#

watch that whole video

fiery wadi
#

but i will also watch that video ! 🙂

#

Q : If i choose Replicates on the Actor's root then are all components automatically replicated or do you need to check Component Replicates on each Component also ?

#

Am asking as I noticed theres a Component Replicates option on Text Render Component and some others.,, I did read somewhere that if a Actor isnt set to Replicate that a Component will not Replicate even if the Component Replication checkbox is ticked, Which is what prompted me to ask the above quetion 🙂

chrome bay
#

And of course, only the properties that are actually marked for replication will replicate. I doubt text render component has any replication logic.

balmy gazelle
#

If the server calls a function from one of the player controllers say:

void ACPlayerControllerSeek::StartCache(TArray<ACameraActor*> CacheCameras) {
    CacheCamerasArray = CacheCameras;
    PreCacheCameras();
}

To set that cameras in the array as you can see there, this function need any type of replication or anything ?

chrome bay
#

If you want the client to run that code, then yeah, it would need to be a Client UFUNCTION

grand mica
#

Quick question - is it possible to debug the dedicated server which is run on the editor? by unchecking run under one process

kindred widget
#

Why are you trying so hard to make clients and server have different classes? This isn't at all how the engine is designed to run. A dedicated server is nothing but an copy of the game running without a renderer.

quartz widget
latent heart
#

Looks like it's because the barrel is updating first and then the tank body. Thus causing it to flicker.

modest crater
#

If it’s under one process then the engine is basically just ticking two different worlds and ifs seperate then both instances still are running at the same time and refer to the same symbols so you can break point and debug either way

balmy gazelle
#

Executing a game in editor with a listen server mode and itself + a client the log return that the first game controller call is on a Standalone Net Mode and the next one pass under Listen Server, is that normal ?

cobalt notch
# prisma osprey Hey man sorry for the late reply, I wrote you a big message then my internet wen...

Yeah that video is useful 'cos single player games are mostly about psychology. Multiplayer games can be fun just shooting each other like playing in the park without anything fancy so that's just more technical infrastructure and coding wise. If you want to avoid frustrations and publish games start with single player and the basic rules of multiplayer are pretty easy you can even do simpler games in blueprint only if you're not aiming to do fortnite. If it works in multiplayer it also works in single player so you can do both if you're only looking for simple things like say a chess game that's 1 on 1 and you're just replicating the positions of the pieces that each player moves, well you do not need C++ for that and this doesn't involve any Gas or anything like this either.

cobalt notch
# prisma osprey Hey man sorry for the late reply, I wrote you a big message then my internet wen...

If you get time I would recommend learning C++ but you'll probably need to do some Udemy courses. You can do that alongside but honestly there isn't a huge point to C++ unless you're gonna do a framework or complicated things or multiplayer (because there are a few limitations of blueprints in multiplayer). It's kind of handy if you need to like make a complicated tick function that runs every frame then you can do that in C++ to make it faster and it's great for understanding how unreal works. However life is short and I haven't had any time to do blender since I started this C++ project but technically I am doing fortnite. I found that open worlds are hard to do 'cos of things like the land gets loaded on all clients anyways so if you have 100 clients and a huge map it's not really built for this. I've found some tricks around this but this is easier with the type of game I'm making there is hardly any land haha. Okay I'll add you as a friend so you can ask me any questions if you get stuck or if you want any course recommendations.

hallow dagger
#

im trying to implement spectator mode, where dead players can see from the perspective of players
when a player dies, I run Set View Target with Blend, on the dead player's player controller, targeting one of the living players
this kind of works, because the camera now is following the player, but it is not applying its rotation, so the spectator is stuck looking south

if I try to adjust the rotation of the camera with set control rotation, it does nothing at all
I tried to run unposses on the spectator's player controller, and this makes the set control rotation to work.... but the camera no longer follows the target player

I'm kind of lost, anyone has any idea or suggestion?

compact flame
#

How do I go about replicateing detaching? attaching works fine but detaching does not

balmy gazelle
velvet current
#

Hi guys, I'm having issue replicating Launch Character despite calling it through a replicated event. It's happy on the server and stutters like crazy in the client. In the video, the two left screens are clients, the right is a server.
Can I get a helpful hint here? Been working on this several days, followed every relevant lead on google, unreal forums, and YT tuts.

thin stratus
#

You would call it locally and then via a ServerRPC. There is no need for the Multicast.

#

And that coooould still cause corrections fwiw.

grand kestrel
#

Will cause corrections

thin stratus
#

Na, LaunchCharacter is strangely enough quite fine

velvet current
#

I’m using it as a one-time boost, not for consistent movement

grand kestrel
#

Maybe if you use something in the environment like a launchpad it'll be fine

velvet current
#

Like a wave dash of sorts

thin stratus
#

I wouldn't call the Multicast fwiw

#

But yeah, a Key -> Dash/Boost is usually not possible without C++

#

Well, without corrections

grand kestrel
#

Yeah that needs to be predicted

velvet current
grand kestrel
#

Entire games are made without a single net multicast (beyond what the engine itself uses) 😛

thin stratus
#

No, that's you just sending the Client, who would already predict the velocity change, that they need to boost again

#

Client boosts, tells Server to boost, Server tells everyone again to boost.

#

Redundant even

velvet current
grand kestrel
#

That'll give you ~150ms latency

velvet current
#

Am*

thin stratus
#

If you add them in BPs, then you need to at least do the ServerRPC, but you will also most likely have corrections.

#

Cause there is a lot more to predictive movement than that RPC

velvet current
grand kestrel
#

That can't actually work, so you're seeing false positives

#

First step is to figure out why you're seeing sane results

thin stratus
#

In most cases, users who think their BP setups work have never properly tested their game in an actual Multiplayer setup or have found some edge cases.

velvet current
thin stratus
#

a Physics Object thrown by a Player should have problems. Either it's laggy cause it was only thrown by the Server, which leaves the Client with a lack of Interpolation.
Or you are throwing it on Everyone with a Multicast, and then you won't have deterministic physics on everyone and people will see different results.

#

Whenever I have to deal with throwing stuff I use a ProjectileComponent, cause that at least does some smoothing on clients.

#

Physics are almost always a nogo

velvet current
thin stratus
#

Welp, I can only tell you what I experienced the past 10 years.

#

That boost will s*ck in BP only

#

Unless you don't care about cheating and just set the CMC to Client Authority

#

But never tried that

velvet current
thin stratus
#

There are pins on this channel with some simple code samples for that

#

Vaei's post that is pinned iirc

grand kestrel
#

The samples included are generally states that you enter, like prone/strafe/sprint/etc
I would model that ability closer to how CMC handles jump

velvet current
grand kestrel
#

This one

velvet current
grand kestrel
#

Cross reference it with how the engine handles UCharacterMovementComponent::DoJump() because that's relevant to your wave dash

grand mica
cobalt notch
grand mica
cobalt notch
grand mica
cobalt notch
#

Some things aren't on the server or client at all so you should first check you're not attempting to debug something that's not even on the server at all.

grand mica
cobalt notch
grand mica
#

I need to do the logs.

grand mica
cobalt notch
blazing bear
#

Do you guys use Validation on all Server RPCs ? I feel like it doesn't make sense sometimes, like when interacting with something, I just check if the trace hit bool is true and if the object matches the requirements, if I put these requirements on validation, the client gets disconnected for simply pressing E on nothing for example

latent heart
#

It rarely makes sense to use the actual Validation method as that'll kick people for cheating if it fails.

#

You should definitely validate what your clients do, but that method is too extreme.

blazing bear
#

Ah I see

latent heart
#

Unless you're validating the use of admin commands or something?

#

Something obviously wrong.

blazing bear
#

So validate only when really necessary, like something that could be cheated

#

No I was talking about validating the Interact server rpc

#

Like interacting with a door or whatever

latent heart
#

You could validate the distance they're interacting from.

blazing bear
#

Yeah I did something similar to that, but the problem arises when you're pressing E by missclick for example, the server will return false on validation for a mistake

#

Like if you didn't mean to interact at all with the object

latent heart
#

You can't "misclick" and interact with something 5km away unless your game code is fubar.

blazing bear
#

I don't know how to explain? Imagine a scenario where you're new to the game and testing inputs, you press 'E'. You send a server RPC, and then you get kicked out because validation returns false. But now as I'm typing this, I think I missed the part where you should check for the same condition on the client before sending the RPC?

latent heart
#

My point is that if you press 'E' you aren't going to just interact witha specific object no matter where you are, are you?

#

You're going to interact with the one that's in front of you.

blazing bear
#

Yes exactly, but what about pressing 'E' when you're looking at the sky for example?

latent heart
#

Do a range check on your client code?

#

Like don't interact with things in the sky.

blazing bear
latent heart
#

The server should only ever get "valid" rpcs.

#

So always check locally first. 🙂

#

(unless somebody is cheating)

blazing bear
#

Yeaah haha I don't know how I missed that

latent heart
#

Valid does not mean correct. It just means it could be right.

#

Like 1 + 2 = 7 is valid. 1 + 2 = elephants is not valid.

blazing bear
#

Yeah I see what you mean

latent heart
#

A "valid" call is on something that's usable and nearby, in range. A "correct" call is something you're able to use nearby and allowed to because of game logic, where the invalid one might not be usable yet because of game logic.

blazing bear
#

Yep, and I somehow just forgot about the "correct" call and took it out of the code when implementing the validation

latent heart
#

Forever editing my sentences.

blazing bear
#

Hahahaha happens

#

Thanks for not only this info, but all the other infos I get when I CTRL+F this channel hehe

latent heart
#

Np. 🙂

grand mica
#

Hello!
Does someone has some experience in netcode? Inpterpolation?

grand kestrel
#

Better to just ask your question

grand mica
#

If I am making a custom movement component that inherits from the pawn movement component. Would it force me to use the predictability system like CMC + GAS?

#

because that's the code in Unreal which makes the SendClientAdjustment() to CMC

grand kestrel
#

What is your movement component for, players or AI?

grand mica
#

Players

#

it is for players but there can be plans for AI in future but the priority is for players

#

@grand kestrel

grand kestrel
#

Can't really give advice with a lack of details

grand mica
#

and it's a fighting game so I think I'll need it

grand kestrel
#

Oh. Yeah that's an exceptionally complex topic

#

You need a separate thread away from the game/render thread
And fixed point numbers instead of floats/doubles
And input polling from within the separate thread

#

Sounds like you want GGPO

#

But GGPO requires a deterministic physics engine that Unreal doesn't have

grand mica
#

GGPO is for Peer to Peer

#

I would have more than 2 players

#

something that brawlhalla uses

#

i think they use server-client

grand mica
grand kestrel
#

Yeah GGPO is no good for >2 players

#

You will still need everything else I said

#

The good news is that building a physics engine for AABB (axis-aligned bounding-box) only is significantly easier than building a full physics engine with OBB (oriented bounding box), spheres, capsules, and so forth

grand mica
#

I understand the fixed point issue but why is there a requirement of input Polling from a separate thread?

grand kestrel
#

Because if you're polling input from the game thread then the inputs will differ at different times

#

And determinism breaks

#

Physics engines occur in multiple stages

  1. Hashing (usually Spatial), to pair everything that can collide with what it can collide against
  2. Broad-phase collision, to determine if their bounding boxes overlap
  3. Compute linear/angular velocities
  4. Integration (of velocities to transform)
  5. Sim recording/replaying
  6. Repeat step 1 because they've now moved
  7. Narrow-phase collision, to determine is their actual collision shapes overlap
  8. Contact solver - what happens to shapes that collided
  9. Constraint solver

But because you only need AABB you can skip step 6/7, and you probably don't need 9

#
grand mica
#

I didn't expect this much from a simple 3d fighting games. This sounds like I might need to think in a different way now.

grand kestrel
#

Unreal isn't built for fighting games or anything that requires determinism at all
Deterministic physics engine is not generic at all, and only suits very specific applications, so engines don't ship with them

fossil spoke
#

"simple" and "game" dont go together

grand kestrel
#

Fighting games in particular are deceptively complex

#

RTS as well, probably even more so

fossil spoke
#

Every game is deceptively complex

#

In their own ways

#

This is the common misconception from those that dont make games for a living lol

grand kestrel
#

The other thing with fighting games that makes ready-made solutions unavailable is that for myself, as a programmer, despite being a reasonable artist, the art requirements are so extreme/severe that it just isn't worth building for

#

Fighting games live and die by their characters possibly even more than their actual netcode/gameplay

#

So even though I could integrate GGPO into Unreal, until someone with those art skills and budget decides to hire me to do it, I'm not going to waste my time

#

I'm not sure if there are other types of games that can benefit from determinism, but I think its really just fighting games and RTS

fossil spoke
#

Im sure there are benefits, but whether or not they require it is a different story.

grand mica
#

no good news for me lol

#

do you think a game like brawlhalla had to go through that much?

fossil spoke
#

Fallguys might benefit from a deterministic physics solution, to maintain more accuracy, but Im sure it runs fine without it, mostly because Players dont really notice or care for the most part.

grand mica
#

my game doesn't even require blending of animations

grand kestrel
#

I don't know what Brawlhalla does tbh
I played it a very long time ago

#

IIRC it had some issues of its own

grand mica
#

so what if I move with the physics solution unreal has?

#

and do a simple netcode with my requirements

grand kestrel
#
  • Determinism is out the window
  • You'll provide servers that benefit the closer player, OR
  • Players will host that benefit the hosting player, who can cheat
#

And, players will complain about your netcode

#

You could look at a hybrid approach with an authoritative middleground; I suspect Tekken 7 did something like that, but they're not exactly heralded for their netcode either

#

Lockstep isn't an option with that many players, it won't be responsive enough, unless you're making... An RTS

#

As far as Unreal's server-client models go, I'm not sure they're well suited to this

grand mica
#

uhmm it happens in most of the games isn't? Someone closer to the server is obv benefitting

grand kestrel
#

And as an indie the last thing you want is to pay for dedicated servers

#

So you're basically left with listen servers

#

The host will have 0ms latency, everyone else will be based on distance to host, and host can cheat

#

I think Tekken 7 uses something entirely different again, where it introduces input delay while waiting for input from all players

#

So its nasty if there's any latency

grand mica
#

I mean in games like CS GO, Valorant - players closer to the server are benefitting more

fossil spoke
#

There is only so much you can do to combat latency

#

Its a fundamental restraint of the physical world.

grand kestrel
#

So if you:

  • Create deterministic physics
  • Predict the inputs like CMC
  • Implement record/replay for your physics
  • Synchronize from server/authority
  • Implement latency compensation

I think that's the best outcome with Unreal's server-client model

#

The reason this feels exceptionally complex compared to other game types with Unreal, isn't because its more complex, its because Unreal doesn't have an out-of-the-box solution available for you to use

#

Its actually less complex if you were to build both systems from scratch

grand mica
grand mica
#

CMC I guess defers the update of the capsule component

grand kestrel
#

Because determinism requires fixed-point math which is useless for anything that doesn't require it
That generally means you use int64 instead of a float/double and avoid division

#

And, as mentioned, running in it's own separate single thread with input polling from that thread instead of passed in from the gamethread

grand mica
#

that can be done by converting the timestamps to int?

grand kestrel
#

Its not timestamps I'm talking about
Its transforms

#

There is no feasible way to do it, changing UE4 from floats to doubles was an astronomical undertaking, changing to integer math is all but impossible

grand mica
#

I have seen CMC quantizing the location, rotations as well in their system

grand kestrel
#

You'd have to build your own physics engine that uses fixed-point math

#

That's just compression, it loses even more data, which is exactly what you want to avoid

#

Using fixed-point math, or integers/whole numbers, means there is no rounding and nothing to lose

#

And that is essential for determinism

grand mica
#

righttt

grand kestrel
#

You could have a int64 for Location.X
And then a uint64 for decimals of Location.X's int64
That's how fixed point math often works

grand mica
#

got it! looks like I would either need to compromise or implement a solution

#

and a solution doesn't seem like an easy way

grand kestrel
#

You can get away with
1. Hashing (usually Spatial), to pair everything that can collide with what it can collide against Simply compare all shapes from other characters of within x dist
2. Broad-phase collision, to determine if their bounding boxes overlap
3. Compute linear/angular velocities Just linear
4. Integration (of velocities to transform)
5. Sim recording/replaying
6. Repeat step 1 because they've now moved
7. Narrow-phase collision, to determine is their actual collision shapes overlap Using only AABB there's no need for narrow collision
8. Contact solver - what happens to shapes that collided
9. Constraint solver You probably don't need constraints either

#

It shouldn't really be too complex if you understand the basics

#

Gather all the bounding boxes from each character & Match them against each other
Check if any of those overlap
Compute linear velocity (just add or subtract velocity based on input)
Add the velocity to the transform
Sim record/replay (this is literally just recording timestamps for transforms and reapplying them)
Check again if anything overlaps now that they've moved
If they overlap, push them away from each other

grand mica
#

that's very very insightful. Really thankful to you

#

so the bounding boxes you are mentioning is gonna be handled in the separate thread which will take input polling and handle physics?

grand kestrel
#

Everything would be handled from there, it would have to update at a fixed time step

grand mica
dark edge
#

Check back in 5 years when you're done with the first draft of it.

grand kestrel
grand mica
chrome bay
#

Unreal doesn't have fixed timestep unless you use Async Physics

#

CMC also doesn't care about physics timestep, it's independent from that

grand mica
#

I am not sure if Async physics can be used in my case but this physics seem to be an issue for now and I need to figure out a way to make it fit to my requirements even tho I might need to compromise with a few things

#

If I think of my game then all it might need is AABB collision.

chrome bay
#

The capsule is just deferred until the character physics is processed. The character isn't a physics object, it's kinematic.

#

But character "physics" are not rigid bodies

#

So they are unaffected by the physics scene

grand mica
#

sorry if its a dumb question but I am trying to get more clarity here 😦

#

The only place where I need Unreal's physics is just for the collision detection, thats all.

chrome bay
#

It's a Kinematic body. It's still part of the physics scene, it's just not "simulated"

grand mica
chrome bay
#

everything with non-query collision is a kinematic rigid body

#

But that doesn't mean it's a physics simulated object

#

It's just part of the physics scene and is known to it for collision

#

you're actualy movement simulation doesn't have to be done inside the physics engine, which is how CMC works.

grand mica
chrome bay
#

CMC is deterministic IF you run at the same framerate, and on the same hardware and with the same compiler flags

#

But then so is Chaos in that regard

#

What's the issue you're having?

grand mica
chrome bay
#

I should clarify, it's deterministic assuming all simulation parameters are identical - which in a multiplayer game, they almost never will be

grand mica
# chrome bay What's the issue you're having?

I was actually working on my own movement component. Very simple if we compare to CMC. I was asking if I use Movement Component for prediction system then would the architecture of the system would be more like CMC + GAS? I got those suggestion while I shared more info about it

chrome bay
#

This is the point about determinism, absolutely everything that effects your sim also needs to be part of that deterministic step - otherwise, implicitly, it's not deterministic

#

If you have two clients controlling players that have blocking collision to each other, determinism is literally impossible with a predictive model

grand mica
grand mica
#

oh it handles collision in its movement updates

karmic trellis
#

Hi, I have a basic movemental players for Listen Server project but client pawns movement is bad. How can I improve it? 🤔

  • in video, left large disc is Client and brown is Listen Server. all have same settings and movements.
fallen fossil
#

Hey, can I spawn replicated actor from client actor thats has no replication ?

kindred widget
fallen fossil
kindred widget
#

Things only replicate when they are created on the server.

fallen fossil
#

I got spawner actor without replication. And they also got player few player stats (i know it should be player state) but lets ignore it.

Maybe I could enable replication for SpawnerActor, but use only Events to spawn on server, and keep all stats local ?

torpid girder
#

hello, i want to communicate with external services, i was wondering, is it possible to create a simple ssl tcp socket without using external libs?

fleet bear
#

anyone know of a way to have something like this but have replicated secondary worlds? My goal is to have an open world online co-op zelda like. Typically in these games there are buildings where the interior is bigger than the exterior and or dungeons are separate levels. Other than hiding levels like this under the map (not a great option), this type of plugin was the only thing I could think of.

https://www.unrealengine.com/marketplace/en-US/product/multiworld

Unreal Engine

Manage multiple UWorld instances simultaneously, running different worlds in parallel with isolated actors and components. Transfer players and actors between worlds.

wet nymph
#

Hi I'm facing a problem with the replication system, I'm developing a voxel game, and as chunks get created and destroyed on the server, it seems that the destruction is not always replicated on clients, resulting in inconsistent actors count:

dark edge
wet nymph
#

Well, the server has 72, Client 0 has 144

#

Client 1 has around 172

dark edge
#

What does a chunk represent, a chunk as in Minecraft, a subset of a few hundred or thousand voxels?

#

or is 1 chunk 1 voxel?

wet nymph
#

1 chunk represents 16x16x16 blocks rendered as one mesh

dark edge
#

Show how your destruction is replicated. When does a chunk get destroyed, when all blocks are empty?

wet nymph
#

It gets destroyed when players are too far away from the chunk

#

I have a list of all chunks that must be maintained (ToLoad) and compare with the current loaded chunks, I destroy all the loaded chunks that are not in the chunks to maintain (ToLoad)

#

It seems to be working great, as on server, it maintains the correct number of chunks per player (in the current case 32 per player)

#

But on clients, many chunks aren't deleted

dark edge
#

how do clients know about the chunks being loaded and unloaded, the spawning and desruction of replicated chunk actors?

grand kestrel
#

CMC is still affected by render tick too, it isn't running a fixed timestep

#

All its doing is adapting those intervals based on the render tick delta

#

CMC is literally designed for non-determinism

#

It will never be compatible with creating a fighting game where determinism is required

lament cloak
#

Has anyone using Iris successfully got Subobjects to replicate?

grand kestrel
#

Lots of people have, its a very common thing to do

#

Just ask the question

lament cloak
#

Oh good point, I should have asked it --

Basically, I'm running into this, and I'm a little stuck on how to fix it. I've followed the docs, I've added the RegisterReplicationFragments() to the subobject. I've got bReplicateUsingRegisteredSubObjectList = true; on the owner object. I've called AddReplicatedSubObject(TheSubobject) on the owner.

Edit:

It's worth noting that the owner is a freshly spawned Actor

Edit 2:

A clue:

LogIrisBridge: Error: ActorReplicationBridge(1)::BeginInstantiateFromRemote Failed to find Outer [NetRefHandle (Id=596):(RepSystemId=?)]NOT_IN_CACHE for dynamic subobject

#

This is in ObjectReplicationBridge

grand mica
ashen plume
#

in cmc are movement mode changes replicated and predicted?

wet nymph
dark edge
wet nymph
#

Yes

dark edge
#

That is weird, you doing anything non-standard in the destructor or end play or whatever?

wet nymph
#

I have this

#

It triggers two functions:

quiet yarrow
#

Any idea whats causing this? Sorta a weird issue. These balls are spawned in as server, then switched to client. The balls seem to work, but then some of them freeze and eventually extrapolate and then freeze again. I am using SmoothSync with sync ownership set to true

quiet yarrow
#

solution found: Multicasting the client ball switch fixed this

fallen fossil
#

Why simple physics replication is not ideal?

#

is there some optimal way to sync them instead of doing Multicast with timer / tick intervanls ?

#

or maybe its due root component being default ?

compact flame
#

I may be stupid here but this does not work.... When client clicks button it does nothing. Server has to click it even though server does not have gun its I know it reads the click on client because it prints the string

eternal dune
#

I want to learn replication and serialization in detail by going to the engine source code, but other than starting with AActor and FArchive I don't where to begin reading. Does anyone have any suggestions on that?

fossil spoke
#

UPackageMapClient is also a good class to look into.

#

For example.

#

Here is where Actors are literally spawned on the Client when Replicated.

woeful wagon
#

Hello im trying to replicate all of the points across to the players all players will have the same amount of points I tried to use a for each loop for the players with no results any help would be grand!

modest crater
woeful wagon
modest crater
woeful wagon
dark parcel
#

Don't use multicast for stateful behavior

#

Score should be handled, added and counted by server only. Client should only receive the updated value from the server.

#

Unless client can set it's own value by design but I doubt that's what you want to do.

woeful wagon
wet bridge
#

Is there a way to maintain the same random idle animations between server and client? It's not that big a deal if I can't do it, but it's still overall better

chrome bay
dark parcel
# woeful wagon So where would the most optimal place for this be I just have it running on the ...

You just make sure that the code only run on server machine.

Depending on what tou are doing rpcs shouldn't shouldn't be needed at all, unless the client have a say.

Picture a coin collecting game where upon contact with the coin, score gets added.

You can just care about the collision that happend on server machine.

On overlap-> has authority -> authority pin -> set score.

That's it no rpc or other things needed.

#

If score is marked as replicated the client score will eventually be updated

woeful wagon
silver lagoon
#

hey all, maybe a simple question, maybe not; when I have an actor and sub components that I don’t want to replicate but are still part of a multiplayer game, is their logic executed on the listener server or on the client where they are spawned? To clarify, I have a player that I don’t want to replicate (I know, strange game); who is responsible for ‘executing’ it?

#

I admit I’m a bit confused by all the tutorials and guides I've read in the past days (so zero practice or most)… I’ve kind of lost the thread and I’m trying to find some ‘solid points’… thanks in advance

silent valley
silver lagoon
silent valley
silver lagoon
silent valley
#

yes

silver lagoon
#

so last question (and thank you for helping a noob) .. the player itself in a multiplayer context is mostly run in the local client, replicated on the server and then .. replicated to all other clients ?

silent valley
silver lagoon
silent valley
#

usually the animation is driven by reading values from the client/cmc not replicating state directly.

silver lagoon
# silent valley usually the animation is driven by reading values from the client/cmc not replic...

so in order for the clients to see the ‘correct’ animation, I need to make sure that the internal state I use to decide what to show is properly replicated… but at that point, I don’t understand, is there a moment when the remote clients automatically ‘execute’ the player’s code, apart from the part that comes from the server .. or do I need to do execute it via other means (ie RPC) ?

silent valley
silver lagoon
silent valley
#

Yeah it takes a bit of time to get a feel for how it works. But when it clicks it all makes sense.

fallen fossil
#

Who must be the owner of actor to do RPC? Player pawn or controller ?

cold cipher
#

testing with advanced sessions plugin, how do I simulate connecting with a steam account (including using a real one)
because it keep failing when I'm trying normally(?)

dark parcel
#

You need to use multiple machines

#

At minimum one as a host the other as a client

tardy fossil
#

i'm pretty sure the CMC is deterministic, since it uses sweeps and traces as opposed to simulation physics. it just isn't at a fixed tick rate

#

whoops i was scrolled way up

chrome bay
#

it is, if you can keep every influence deterministic too, which in reality is almost impossible

keen adder
#

Heya guys,
Does each client get its own player controller?

I assumed it would, but calling getPlayerController(0) gives errors on clients. Do we need to pass their specific client index?

#

This is specifically used for player controls, so no replication needed

haughty ingot
#

The errors you’re getting are most likely stemming from the context you’re calling the function in

keen adder
#

However calling GetPlayerController(0) gives errors that it's not found, or server only or something

#

I heard of using GetController instead, as GetPlayerController(0) seems to try and get the server version?

#

I'm a bit confused on what the difference there is. Like why would there be 2 different functions that essentially do the same thing but, not

haughty ingot
#

It all depends on the calling context

#

Is the server executing the logic that calls Get Player Controller? If it is, it will return the server's local player controller.

keen adder
#

No it should all be local

#

Like the players own movement controls, pulling up their inventory, etc.

haughty ingot
#

Pictures will make this go a lot faster

keen adder
#

Not much to see lol

haughty ingot
#

The logic

keen adder
#

It just doesn't like me using GetPlayerController(0)

#

It's just this, not much logic to show

#

(Note: This is an angelscript plugin, not C++)

#

GetPlayerController(0) is just nullptr

#

when playing as a client

haughty ingot
#

Oh pff, never touched Angelscript. Sorry

keen adder
#

It's exactly the same as C++

#

Just removes headers and some other annoyances

haughty ingot
#

Well my advice is still the same, it's the wrong calling context whoever it's being done

keen adder
#

Yes but telling me it's wrong is not very helpful lol. I can see that it's wrong

haughty ingot
haughty ingot
keen adder
#

Just trying to figure out the right way to get the local player controller

#

As GetPlayerXXX seems to be server only

keen adder
#

So it seems like there's no static way to get the local player. That was my issue, relying on anything being able to get the player reference at any time.

#

Will have to modify a bunch of stuff and drop the static references. Sadge

rocky kestrel
#

When I press 'N' I want locally spawn ai controller with running behaviour tree. Its working on netmode: 'standalone' but not in 'play as client'. Can anyone know why that happens. Ai controller is not replicated.

#

This is in Ai controller and print gets always printed but behaviour tree never runs

#

This breakpoint gets alerted only netmode standalone

quasi tide
keen adder
quasi tide
#

I don't remember the exact syntax in AS though.

quasi tide
#

Could also iterate playerstates as well. They have references to the controller

#

It'd be null if it doesn't exist

keen adder
#

Oh sweet.

#

Then I after finding the local one, I could create my own static "PlayerController". So everything is able to reference that

#

Very cool, should work perfectly. Thanks man!

quasi tide
#

Eh - I wouldn't do that. Just do a static method that gets it.

#

So you don't need to worry about properly cleaning things up and all that.

keen adder
#

But would the static method run GetAllActorsOfClass<APlayerController> every time? Or iterate the PlayerStates

quasi tide
#

So what?

#

It is stupid fast

keen adder
#

I fear that might get slow on multiple ticks

quasi tide
#

It won't

keen adder
#

Oh lol

quasi tide
#

GetAllActorsOfClass is pretty much a dictionary lookup at the end of the day

keen adder
#

So what am I thinking that is really slow, is it unity?

quasi tide
#

No. You just haven't measured anything.

keen adder
#

I think it's unity that has a GetAllActorsOfClass that's stupidly slow

quasi tide
#

Unity doesn't have actors

keen adder
#

As it literally iterates everything in the entire scene

#

Objects

quasi tide
#

There is also a huge misconception that GetAllActorsOfClass is slow and it doesn't help that there is a warning on it as well.

#

But that hasn't been the case in a very long time.

#

As for the playerstates - you'd be iterating, maybe 4 elements. I'm assuming you're doing a 4-player coop game, as that is the more sane thing to do rather than some 32 player pvp game or w/e

#

And iterating 4 elements is dirt cheap

#

Loading a texture will cost more in performance

keen adder
#

Yeah, I dabbled in Unity for a few years and have their inefficient methods stuck in my brain

#

Nice knowing unreal has their shit together lol (mostly)

quasi tide
#

Ehhhhhhhhh

keen adder
#

Alright well thanks for the info man! Extremely useful

chrome bay
#

tbf, it's computationally expensive because it's a terrible solution in the first place

#

same deal in unreal land

haughty ingot
chrome bay
#

GetAllActorsOfClass uses an internal hash map so it's faster than you think. Still a brute force solution that has many better approaches

haughty ingot
#

It does.

quasi tide
#

No it doesn't dude

#

Have you read the code?

haughty ingot
#

You don't have to take my word for it, look at the code

quasi tide
#

I literally did

haughty ingot
#

It's just a TActorIterator

quasi tide
queen escarp
#

hey im having issues changing a material on server

haughty ingot
#
void operator++()
    {
        // Use local version to avoid LHSs as compiler is not required to write out member variables to memory.
        AActor*           LocalCurrentActor      = nullptr;
        int32             LocalIndex             = State->Index;
        TArray<UObject*>& LocalObjectArray       = State->ObjectArray;
        TArray<AActor*>&  LocalSpawnedActorArray = State->SpawnedActorArray;
        const UWorld*     LocalCurrentWorld      = State->CurrentWorld;
        while(++LocalIndex < (LocalObjectArray.Num() + LocalSpawnedActorArray.Num()))
        {
            if (LocalIndex < LocalObjectArray.Num())
            {
                LocalCurrentActor = static_cast<AActor*>(LocalObjectArray[LocalIndex]);
            }
            else
            {
                LocalCurrentActor = LocalSpawnedActorArray[LocalIndex - LocalObjectArray.Num()];
            }
            State->ConsideredCount++;
            
            ULevel* ActorLevel = LocalCurrentActor ? LocalCurrentActor->GetLevel() : nullptr;
            if ( ActorLevel
                && static_cast<const Derived*>(this)->IsActorSuitable(LocalCurrentActor)
                && static_cast<const Derived*>(this)->CanIterateLevel(ActorLevel)
                && ActorLevel->GetWorld() == LocalCurrentWorld)
            {
                // ignore non-persistent world settings
                if (ActorLevel == LocalCurrentWorld->PersistentLevel || !LocalCurrentActor->IsA(AWorldSettings::StaticClass()))
                {
                    State->CurrentActor = LocalCurrentActor;
                    State->Index = LocalIndex;
                    return;
                }
            }
        }
        State->CurrentActor = nullptr;
        State->ReachedEnd = true;
    }```
quasi tide
#

I also actually measured it with 100k actors in the world. Guess how long it took?

haughty ingot
#

^^ Iterates through all actors

chrome bay
#

I'm thinking of TObjectIterator, mb

#

But yeah either way, it's a brute-force solution for when you have zero other alternatives, so of course it's "slow" relatively speaking

quasi tide
quasi tide
#

Sooooooo slow

haughty ingot
#

Your test was flawed.

quasi tide
#

Okay. Keep avoiding fine solutions 👍

haughty ingot
#

You need to use the Unreal Trace to get accurate performance measurements.

#

There's a scope cycle counter on it for a reason

quasi tide
# queen escarp

Material changes should be onreps anyway. They're stateful

queen escarp
#

why ?,

#

or well if u mean they wont be changed for "newly" join players i get taht

#

i wont have that issue in this type of game

cyan lava
#

GetAllActorsOfClass does utilize the TActorIterator which is more performant than a standard brute force approach to getting ALL actors, its by no means a dictionary look up. It still heavy and has pretty substantial overhead to it, just not as heavy as a manual iteration through all actors in a world

haughty ingot
#

^^

quasi tide
#

Dang - just too slow 🤷

haughty ingot
#

Can't argue with that test

quasi tide
#

I literally thought the same as most people until I was challenged to actually read the code and test it in a packaged build. I was proven wrong.

#

Is it the best solution? No. Does it work for what they need? Yes.

haughty ingot
#

Of course you won't notice the performance implications of using it a couple times. But it's a poor recommendation, and it has a higher performance cost then just doing something else that isn't taking a lazy approach.

quasi tide
queen escarp
#

yeah the player is calling it

quasi tide
#

Was just fine

#

I also told them they could iterate the playerstates - which is also a valid approach.

#

They have options. They can pick what they want

#

As for doing it occasionally - they likely only needed to do it occasionally as well.

#

So again, it is fine

haughty ingot
#

That's just cargo cult thinking lol

#

It's bad advice to even tell him to iterate over all player states with GetAllActorsOfClass, there's already an internal PlayerState array that's held by the gamestate. Just because you can doesn't mean you should.

quasi tide
#

I didn't say to do that

#

I said to use GetAllActorsOfClass with APlayerController

#

Not with player states

chrome bay
#

tbf you also have FPlayerControllerIterator

haughty ingot
#

There's plenty of other ways to get the player controller without needing to use a lookup lol.

chrome bay
#

GetAllActorsOfClass does indeed use the hashmap, mb.

#

Double mb now

haughty ingot
#

It does, but it's still an overhead.

queen escarp
#

@quasi tide hmm its changing on the server but not for the client for some reason :/

haughty ingot
#

It's obviously not for(AActor* Actor : Actors)

chrome bay
#

Ye. I don't use it.

queen escarp
#

wdym ?

quasi tide
#

Did you even read what was written?

chrome bay
#

🍿

quasi tide
# queen escarp wdym ?

The actor is too far from the player to be considered network relevant. So they don't get the rpc.

haughty ingot
quasi tide
#

I think you have some reading comprehension issues

#

I didn't say that I didn't give that recommendation.

cyan lava
#

It does have some overhead to it, definitely more efficient than a manual iteration over all actors. The performance implications wouldnt scale linearly based on the amount of actors, but it shouldnt just be used in place of a proper reference to an object I think is what Elliot is saying

haughty ingot
#

Generally people still start attacking others competencies when they are frustrated and emotional in arguments. So have fun, I'm done with you. Quit being a child.

quasi tide
#

I've told you multiple times my position. Saying it again won't change much.

#

If you think this is emotional...I don't know what to tell you

crisp shard
#

When it comes to adding background music to multiplayer games how would someone recommend going about this? Should I spawn like a music manager bp or something to handle it?

quasi tide
#

Told them that things generally already have a reference ✅
Told them about GetAllActorsOfClass<APlayerController> ✅
Told them they could iterate the player states ✅

Literally just told them various ways to accomplish what they want

quasi tide
cyan lava
quasi tide
#

The more narrow the class search, the better it will be

queen escarp
#

@quasi tidehow can i resolve that then ?

quasi tide
#

I even tested with a 12 hierarchy deep class structure.

cyan lava
#

Yeah and newer developers over use inheritence and will make this search less performant than it could be because they'll be looking for some base class rather than some composition style structure. A lot of it comes down to putting the fear into new developers so they dont have a reliance on "easy" functions

quasi tide
#

So far, in an actually packaged build - GetAllActorsOfClass has performed far better than what a vast majority of people say.

quasi tide
cyan lava
#

I think we are all on the same page though, its a good conversation and gets the gears turning. I dont think any hostility was necessary though

quasi tide
#

The passive aggressiveness also wasn't needed

#

But I digress

haughty ingot
hoary rock
queen escarp
#

@quasi tide hey no worriest just update: i put the functions closer to the character and it worked so im guessing it had with the relevancy part ! thanks

grand kestrel
tulip rain
#

Anyone got time to look at my Character rotation BP? What's happening is that it is not replicating at all no matter which way we have tried. The logic for rotation works for singleplayer:

hoary rock
grand kestrel
# hoary rock Do I not also need to update it in case of a server correction before replaying ...

Hm that was an overly short answer, 4am brain

To elaborate - PrepMoveFor is to prepare client-side moves, which are then sent to the server
But we don't need to do it there, because we send them as compressed flags instead, so by the time PrepMoveFor is called it already has the required state
Also worth referring to ClientUpdatePositionAfterServerUpdate, where we specifically ensure that the flags don't change, this is where PrepMoveFor is called from
Basically, its handled by a separate routing that is much cheaper (because packed into uint8)

hoary rock
#

Ah I see now, thank you!

crisp shard
#

im looking to have a widget get spawned on every clients screen when a player gets killed, where would i go about doing this ? gamestate?

cold cipher
#

anyone know how to set a session's name?
one that will pop up after get server name
(can include some string splittings too)

thin stratus
fossil merlin
#

Anyone have any experience with AnimNotifies and dedicated servers? When I run the game as a listen server everything runs fine, but when I run it strictly as a client, some of the animnotifes just don't fire correctly. I'm not sure if there's a setting or other variable I'm missing.

verbal vapor
fallen fossil
#

can this be explain by unreal? client actor is in different place 🤔

fallen fossil
#

this actor is create on server side and the just replicated, but it just asking for owning player pawn location

dark edge
fallen fossil
dark edge
#

the thing all this code is in

#

some sort of a heli spawner?

fallen fossil
#

actor that has box collision to check if I can spawn there helicopter

dark edge
#

So WHEN should it spawn the heli?

#

why is input involved

fallen fossil
#

so somebodyu can select place?

dark edge
#

You got way too much going on in there lol.
OK is this like a game where you control one character or is it more like an RTS?

#

Do you walk up to the box, press a button, then choose where to spawn a heli, then spawn the heli?

fallen fossil
#

its mod for squad

#

i found some comment about rebasing, so maybe its not unreal related but squad actually

thin stratus
#

Could be that it rebased on the Client but not on the Server

#

But I thought that it still translates back and forth if needed.

dark edge
#

just tick -> locally controlled? -> calc rot -> send to server

fallen fossil
late stratus
#

I have an AnimNotify that I trigger on the 20th frame of my animation montage. For some reason, it's triggering on the client but not the server. I've verified that the montage is running on the server. Why would the notify not trigger?

sharp hamlet
#

How do I change the “Server Map” at runtime? Like i m a little confused abt this. Do I need to make separate instances of server builds for different maps and create new servers for all those builds?

cursive steeple
queen escarp
#

this is run by a player controller

#

what object should i get to get that players playerstate ?

#

index of a controller should be local ?

sinful tree
# queen escarp

If this is within the player controller, the player controller itself has a variable referencing its playerstate.

verbal vapor
#

And then you can change the default gamemode, map, game instance etc

keen adder
#

Heya guys, so I was asking before but still have a question:
Does APlayerController actually exist locally for clients?

#

On my PlayerController, I simply log GetControlledPawn(), and it shows me this:

#

The server creates a playercontroller with it's ascociated pawn.
When the client connects, it creates a pawn, and then another 2 playercontrollers with no pawn.

What's going on here?

#

Like what's the proper way to control a client's local character (controls/hud)?

  • I can't properly get the PlayerController, and PlayerState seems to be mainly for replicated values only (health/etc)
queen escarp
queen escarp
#

can remote clients activate "events" on the game mode even

#

no

#

but a remote client can access the game state wich in return can access the game mode :/ ?

#

or game state is only servert also ?

#

only player state is by remote ?

#

client *

cursive steeple
# queen escarp or game state is only servert also ?

Its all in the network compendium, I recommend you study it thoroughly. It has all the info you seem to be needing/missing, what objects exist on what (server/client/both), and much more. Cant link the thing atm, it must be pinned somewhere around. C:

kindred widget
haughty ingot
#

It iterates a hash map of all those contained actors

kindred widget
#

But not all actors.

haughty ingot
#

A more accurate statement would have been it iterates over all subset of those actors, so poor wording on my part.

queen escarp
#

@cursive steeple yeah i know thanks ill look at it

kindred widget
#

I was going off of what you said directly after that. But still. It's not a bad function. People are just whiny about stupid shit because they work with idiots who won't stop doing stupid things, and it's easier to perpetuate doing things in complicated manners than to simply use tools smartly.

It's easier to whine about how bad this function is cause someone might actually use it on something iterating hundreds of thousands of actors. And it's easier to tell people to put a fucking interface on everything instead of casting. It's actually quite useful, and several places in the engine actually use it, and people shouldn't be discouraged from it either.

haughty ingot
#

There's a use-case for it for sure, but it's way more commonly abused then it is used in good context. As you said.

#

It should by no means by a replacement for good programming, and that's where the issue lies.

#

There was even a talk recently at UE Fest where a studio actually would fail a Data Validation check if a Get All Actors of Class or Get Actor Of Class existed, they only didn't outright ban them because they're good for quick mockups.

quaint rain
#

Is there a difference in terms of optimization between replicated on OnRep variables?

In general, should I favor replicated or does it not matter?

The variable in question is an enum that changes every 20-30 seconds. OnRep would make my life easier for late joiners, but I can probably put some logic on begin play if I should avoid OnRep.

woeful wagon
keen adder
#

Of all the info online, I can't find the first step lol

quasi tide
#

The hud should be derived from values that are alreadly local to the player

#

Can you clarify what you mean by the other part? "Controlling the character" - because, that's what the player does.

quasi tide
#

Yes

keen adder
#

The issue is this Unit = Cast<AUnit>(GetControlledPawn()); returns null

#

From within the player controller

quasi tide
#

When do you call that?

#

It may have not been replicated by that point

keen adder
#

In BeginPlay, is it too early?

quasi tide
#

Potentially, yes

keen adder
#

Ahhh, that clears up a lot

#

That's the info I just can't find online

twin vessel
#

I have an array of replicated subobjects on a component. Is there a way to have uobject properties on those objects replicate too?

I tried with to reference them on an array on the component and use the same method i used for the first objects, but it does not work

It says LogNet: Warning: UActorChannel::ProcessBunch: ReadContentBlockPayload failed to find/create object. RepObj: NULL, Channel:4

keen adder
#

Is there any events to subscribe to or auto called functions when it runs?

quasi tide
#

I think the onrep for the pawn is a virtual. If not, you can check for the client acknowledge possession event (I forget the exact name, sorry)

keen adder
#

Cool that's a great start. And one last question:

#

When logging that on the client, it logs:
Server: null
Client: null

#

Is there a reason the client is logging as the server as well?

#

Or is the server also loading up the clients playercontroller and logging that?

quasi tide
#

Server has all player controllers