#multiplayer

1 messages Β· Page 60 of 1

twilit radish
#

They call the game instance in the end.

rose egret
#

open xxx error is handled by OnTravelFailure ? πŸ€”

fossil spoke
#

If you are using C++ you may want to look at overriding in the Engine

#
    /** Allows subclasses to pass the failure to a UGameInstance if possible (mainly for blueprints) */
    virtual void HandleNetworkFailure_NotifyGameInstance(UWorld* World, UNetDriver* NetDriver, ENetworkFailure::Type FailureType);

    /** Allows subclasses to pass the failure to a UGameInstance if possible (mainly for blueprints) */
    virtual void HandleTravelFailure_NotifyGameInstance(UWorld* World, ETravelFailure::Type FailureType);
rose egret
#

im writting some automation to launch headleass clients and I want them to shutdown if failed to connect or disconnected

pallid mesa
#

headless clients?

rose egret
#

thats guys , I go try, my code base has grown so that asking here is better than changing the code and waiting to compile

#

😁

twilit radish
#

You probably want to use the NetworkFailure one as that handles basically all scenarios from what I see.

#

See: ENetworkFailure

rose egret
#

I have written client AI that plays the game

#

πŸ™‚

pallid mesa
#

ahh -nullrhi yeah πŸ˜„

#

oh the chaos monkey? that's cool ^-^

twilit radish
#

Chaos monkey?

rose egret
#

w8 I never heard that work

hollow eagle
rose egret
#

im doing that to test the perforamce and gameplay since I dont have 100 coworkers

pallid mesa
#

xD The encysampedia 🀣

twilit radish
#

This is why I'm still sad that one topic on this was on UDN.

#

But honestly it probably came down to just bots yeah lol.

torpid girder
#

oh i just figured out the reason why data isnt being replicated its because its because its being executed on the client

rose egret
#

im using StateTree for my AI btw, its new without any doc but I like it

torpid girder
#

will a dedicated server execute BeginPlay on a player controller?

rose egret
#

though my client side path finding has little problems

#

@torpid girder yea

fossil spoke
torpid girder
#

that is what i thought

twilit radish
#

except when your base class forgets to call the super

torpid girder
#
    if (GetWorld()->GetNetMode() == ENetMode::NM_DedicatedServer)
    {
        Request->SetHeader(TEXT("User-Agent"), TEXT("X-OnlineServices-Server-Agent"));
    }
    else
    {
        Request->SetHeader(TEXT("User-Agent"), TEXT("X-OnlineServices-Client-Agent"));
    }
rose egret
#

can be summarized in one line btw

torpid girder
#

should i use this to test if code is executing on the server over if (!HasAuthority()) ?

fossil spoke
torpid girder
#

I dont

rose egret
#

HasAuthority means == standalone , listen server or ded

fossil spoke
#

You should look at what HasAuthority is doing.

twilit radish
#

GetNetMode() < NM_Client all the way for those kind of checks.

#

And then IsNetMode(NM_ListenServer) or whatever for specific stuff.

twilit radish
blazing spruce
#

Hi, im having an issue with getting this timer started, if I put it on begin play it returns false, unless i put a small delay before it which will then go true and start the timer but I know putting a delay there isn't a fix, any ideas how I can have this timer called only for the locally controlled player properly?

#

My theory is that when i spawn the BP_Caretaker class in the GM, the begin play's firing before its possessed or something causing it to go false

twilit radish
#

If this is a listen server, then yes. That's exactly what happens, which you can easily verify by printing a message indicating which event runs first by overriding the OnPossessed event or whatever it's called in BP πŸ˜„

fossil spoke
#

OnPossessed is only called for the Server.

blazing spruce
#

Yeah i tried putting it in there too but didnt work, i need it to run on client i believe

peak sentinel
blazing spruce
#

only the BP_Caretaker class should see it

fossil spoke
#

@blazing spruce Do you have C++ access?

blazing spruce
fossil spoke
#

You have a few options in Blueprint only.

#

For Clients its best to wait till the PlayerState exists.

#

This is an alternative.

#

Unless you want to properly expose the PawnClientRestart to Blueprint from C++

twilit radish
fossil spoke
#

After it you would check for Locally Controlled etc

peak sentinel
#

They said they use ST

twilit radish
#

@fossil spoke There's a BP event for that called ReceiveRestarted

#

See APawn::DispatchRestart

fossil spoke
#

Im still on 4.27

#

πŸ™‚

twilit radish
#

Give me a second to check where they added that. But could very well be the case.

blazing spruce
#

Interesting that is overridable on the character class

twilit radish
#

Yeah.. UE 5.

blazing spruce
#

so i could use that?

fossil spoke
#

@blazing spruce Use ReceiveRestarted then

#

If you are on 5

blazing spruce
#

nice! ill give it a go, thanks!

fossil spoke
#

πŸ‘

noble sentinel
#

My multiplayer system works when I play it in editor standalone mode 2 clients

#

but I cant play it with my friends nor I with 2 clients

#

Its using steam online subsystem with spacewar settings

twilit radish
#

As in "why don't you just use regular AI instead of clients"

peak sentinel
#

Thats why I asked though πŸ˜„

twilit radish
#

(β•―Β°β–‘Β°)β•―οΈ΅ ┻━┻

peak sentinel
#

APawn still provides a way to do netcode

twilit radish
#

Yeah but that does not nearly simulate the same performance as actual clients that send over network data etc.

#

Maybe CPU wise, but definitely not network wise.

peak sentinel
#

In the context you are speaking of it would be just a matter of having client or authority role

#

And having a "client" AI is more costly

twilit radish
#

An actual client has packet drops that need to be resend, sends healthchecks, has actors that become relevant / irrelevant etc. all while also interacting with the world which in return sends stuff over the network. If you just simulate that with server side AI you don't get any of that.

peak sentinel
#

I think you misunderstood me at first place

#

Generally in other engines and many games AI "logic" is not a part of the netcode either, and to replicate some necessary behaviors to clients you can still use APawn, so I couldnt see the reason why would completely ignoring server-side AI and using a fake client based AI be an option

#

So it was a question regarding to curiosity

#

Made me thought they have a custom architecture or something else, no idea

#

Since having a client AI is more disadvantage and an advantage in many cases

twilit radish
#

I assumed the idea was to have clients that run AI like code to mimic players actually doing stuff in the world to test server/network performance.

#

Not yours, but the person creating it.

peak sentinel
#

Ah I see, yeah I can see your point now

#

I'd like to see that AI though πŸ˜„

twilit radish
#

It's on my imaginary todo list as well for some day as it is an absolute pain to test performance properly. But I don't have the server space for it πŸ₯²

#

Also Battlefield V did it too btw πŸ˜„

peak sentinel
twilit radish
peak sentinel
#

I remember that!

#

though I didnt watch

twilit radish
#

It's a bit generic tbh. But they explained how they used bots to test performance, used it for QA purposes as there was no way they could cover 64 man games with their QA team at all times etc.

#

But overall not disappointed I watched it.

fossil spoke
#

@low helm Again, it all depends on your game, you need to pick a number and target that.

#

Every game is different, every game is designed and architected differently, that all contributes to what level of performance they can manage.

#

You need to pick a number from the beginning and say "We want to be able to support X number of Players, how do we design and build the game to facilitate that."

low helm
#

I wonder if there are any good examples of Listen Server games that have shipped with player counts above 4

fossil spoke
#

Probably, but just because someone else has doesnt mean you should, or that it fits your game.

low helm
#

Valheim is 10, L4D and DRG and Vermintide all do 4

#

Well my use case is mostly standard shooter, CMC and AI are our biggest costs, and nothing there is really unusual

#

So comparing myself to others seems fairly appropriate

fossil spoke
#

If your game is a large world combined arms combat FPS like Squad or HLL, its not going to do well as a Listen Server experience.

#

Your target audience is going to have wildly different hardware and network capabilities and all of that plays into a Listen Servers experience for all users connected to it.

low helm
#

right

fossil spoke
#

That is typically why you see low Player counts for Listen Server games.

#

You cannot hope for the best scenario, you have to expect players to be running on a potato.

low helm
#

Yeah so some players could handle 12-16 connections but some run the game on toasters

fossil spoke
#

Exactly.

low helm
#

Ok cool I think I'm starting to get a better picture of what to expect. I just want to have a hypothesis before I begin testing....like Listen servers probably handle 4-6 players on bad hardware, twice that on good hardware, and twice that on Dedicated Server

#

And see if that hypothesis bears out

#

Sometimes I join a DRG server that performs really badly with just 4 players

fossil spoke
#

You HAVE to have a target before you build the game. It just doesnt work the other way around, you will simply end up making a game that doesnt work for the performance you end up with if you decide about what number of Players you want to support after the fact.

noble sentinel
#

but it dont work after packaging project

#

Like I cant start 2 game instances and make it work

fossil spoke
#

You also have to be realistic about what you can acomplish.

#

No point saying "We are going to make a 120 Pop Battleroyale experience" if you dont have the talent, experience or expertise to actually do that.

low helm
#

Don't worry I tried to remake WoW 6 years ago

#

Learned that one the hard way

#

But it was fun

fossil spoke
#

Everyone in their early days in this industry has had those lofty goals

#

And 99% come to the realization that its just not how it works.

#

Look at it this way, if it was easy, everyone would be doing it.

#

But how many WoW clones exist that were made by tiny ass teams with no experience?

#

Being realistic gives you a CHANCE at being successful.

low helm
#

Yeah and these days cloning WoW isn't enough anyway

#

Even if you could

#

I want just enough people in my game so that artillery coming from a rear guard makes sense, so yeah I'll probably be working towards 16 or 24 players

fossil spoke
#

Thing is, you need to incorporate realistic expectations into your design goals and outcomes.

#

If you want that as an ingame experience, 1 player shooting a single artillery cannon might not be enough to sell it.

#

So adjust your design goals.

#

Instead maybe they command a group of cannons ?

#

It is a game after all, you can bend reality.

low helm
#

Yeah the players in the rear guard manage cannons and supporting reusable rockets

fossil spoke
#

Bending reality is usually because you are sticking within your lane of competency.

low helm
#

yeah that makes sense

#

So yeah it's not just 1 player with 1 cannon

#

It's more like you manage a miniature base

#

Which provides combat support

fossil spoke
#

Whatever the case is, be realistic about your goals, about your time scale, about what you can achieve. All of this will inform your design and the final product. If done right, you have a chance at success instead of no chance at all.

low helm
#

Artillerymen get this little grid camera and dial in each artillery peice manually, no pings

#

Yeah cutting scope has been a multi-year project for me

#

To get down to somethign realistic

#

Where the circles indicate target and radius

fossil spoke
#

Cool, we are drifting a bit offtopic though.

low helm
#

True, I really appreciate the conversation

fossil spoke
#

I hope this was helpful.

low helm
#

Paypal is ready πŸ™‚

fossil spoke
#

You dont owe me anything. Only that you heed the advice πŸ™‚

digital pendant
#

is anyone in here familiar with AWS?

#

specifically gamelift

opal pulsar
#

Is there a way to make a function as only able to run on the server? Not a server RPC or HasAuthority, im curious of any specifiers or anything, I read about one but cannot find it, maybe it was an older unreal thing? I just want to ensure a client cant call a function an if (HasAuthority) seems hacky using it everywhere

fossil spoke
#

@digital pendant Whats the question?

fossil spoke
#

BlueprintAuthorityOnly will cause any nodes with this specifier to not be executed on Clients.

digital pendant
# fossil spoke <@894485330424639488> Whats the question?

im not sure if you will be able to help, but I have an older project that I am coming back to and one of my endpoints seems to not be getting called.. when my game ends it will pick a winner but it seems that the endpoint execution is getting skipped.

fossil spoke
#

Not sure what you mean exactly? The HTTP request isnt being sent?

red pollen
digital pendant
#

either its not being sent or its sent with the wrong authorization and gets ignored.. trying to look into that right now.. it may be something as simple as wrong password

fossil spoke
digital pendant
#

i have another lambda function that verifies that this message comes from the game server so it might be failing that check

#

nothing shows up in cloud watch, I am unsure where to look for api gateway

noble sentinel
#

Im still trying it but stuck...

digital pendant
# noble sentinel Can anybody check this

unless you have the clients connecting to a dedicated server it wont work, unreal will spin up a dedicated server in the background and connect the clients to it

#

or do you have it setup as P2P

noble sentinel
#

and others are connecting with ip

#

Im sending the photos of it in a sec

#

When somebody click host server it open loading level with listen

#

then,

#

this in level blueprint happens,

digital pendant
#

you arent creating a session

noble sentinel
#

and it opens first level

digital pendant
#

ah ok

noble sentinel
#

where is problem can be?

digital pendant
#

Im not exactly sure, i dont have experience with P2P, but I found this which is similar to what you are doing

#

πŸ§‘πŸ»β€πŸš€Get the project files here on Patreon: https://www.patreon.com/posts/hosting-joining-66351331

In this video we take a look at how we can Host and Join multiplayer games using the Session nodes from the Default Online Subsystem integrated in Unreal Engine.

We also go over what an Online Subsystem is, and which different Online Subsystems ar...

β–Ά Play video
noble sentinel
#

should this listen be ?listen or smth?(nope it s true as video shows it like this)

#

That dude in video make it like me

#

with few differences, Im checking it

#

its session create is a bit different from mine

digital pendant
#

Yes, it seems he has the functions set up a little differently. maybe follow him

noble sentinel
#

Im using advanced steam session

#

he is using another thing I think

digital pendant
#

maybe if you watch his set up you can figure out whats going wrong, i dont think it matters much advanced vs regular session node

noble sentinel
#

thank you, I think this is the problem, I should use find session instead of open level for joining

#

Thank you for help

digital pendant
#

πŸ™‚

deep coral
#

how do you check for game package number/version for preventing multiplayer joining of different game versions?

misty stirrup
#

does anyone have any info on having a user cross a threshhold and getting passed to another dedicated server?

#

like load balancing the actors data between two servers? ive seen it done for minecraft w/ zeromq

opal pulsar
#

Is it completely valid to call game mode functions from a server spawned actor if its guarded with a HasAuth()? I'm struggling otherwise to see how a non locally owned actor can call and send info to the server

#

example

void AProjectile::OnOverlap(blahblahinfo)
{
  if (HasAuthority())
  {
    foo* ptr = GetWorld()->GetAuthGameMode<foo>();
    ptr->HurtActor(bkahbhlahinfo)
  }
}
low helm
#

I once wrote a super simple version of this in Blueprints though, where walking into a portal in World A connected you to World B on another server, the address of which I could plug in on the server side of World A

#

But this wouldn't include any information sharing between servers, like WoW had where servers would share duplicated copies of actors on the margin between 2 servers

misty stirrup
#

what really throws me off is like... how should i share the memory?

#

like

#

when i share the player location to the second server, should i just give it the vector location

#

or am i thinking about it wrong; is it about the player input and the current location of the actor

vagrant grail
#

Does anyone know why when I set the number of players to 2 (to have 2 windows open) or more we can't see each other's character ?

#

Ping me if any answeer please πŸ™‚

upbeat basin
vagrant grail
upbeat basin
thin stratus
#

@opal pulsar @upbeat basin since the overlap usually happens on everyone who has an instance of an actor, you are totally free to just limit the code to authority. The rpc part that Layso wrote is true though

deep coral
#

If I execute console command "servertravel somemap" in a multiplayer game, will the new level still be listening (ie, other players can still join)

thin stratus
#

Yes

deep coral
#

how do I stop the listening, so only the lobby players are the ones who can join?

thin stratus
#

You can't stop the listening itself. But you could update your session to not be advertised and joinable anymore.

Or if it's not about sessions you could kick the player when PostLogin calls and you aren't expecting them.

You can also pass ?MaxPlayers=
Along with your server travel and behind the = you pass in the number of lobby players, then other players would be denied due to server being full.

Ultimately I would solve this with keeping track of all the UniqueNetIds that were present in the lobby and then using PreLogin or Login to check if someone is allowed, otherwise return an ErrorMessage.

But PreLogin and Login require C++.

And the Session updating requires either C++ or a Plugin.

If you only do BPs, then your best bet is the MaxPlayers setting and/or handling new players in PostLogin in your GameMode. Not sure what you can use in Blueprints to identify them though

#

@deep coral

deep coral
#

gotcha

noble sentinel
#

really, what did you do to solve this?

#

Im trying to fix this rn

#

Also, this should be work right? I dont know if the problem is my bp

torpid girder
#

hello, i am back trying to understand why I don't see my player controller log message being printed in the dedicated server output. I see the player connect in, however before i tried connecting to a dedicated server i could always see the beginplay being called

winged badger
thin stratus
#

GameSession class as a hole is not a BP thing

#

At least not to my knowledge

winged badger
#

Probably, not near PC to check

torpid girder
#

just need to check, if i run "C:<YOUR INSTALL PATH>\Engine\Binaries\Win64\UnrealEditor.exe" "A:\MyProject\MyProject.uproject" -server -log what build is it running? it doesn't appear to be the development server

#

i put lots of debug log lines in and they don't appear

#

that sounds correct, unless you set a way to replicate then it won't

hollow swallow
#

Would anyone know why all the clients can move fine, but the host cant? cant even look around, they can still see everyone else moving though

torpid girder
hollow swallow
#

Only using the third person example one. Was following kekdots multiplayer tutorial

torpid girder
#

i am trying to figure out which build of my code "C:<YOUR INSTALL PATH>\Engine\Binaries\Win64\UnrealEditor.exe" "A:\MyProject\MyProject.uproject" -server -log executes, because its not the development build as i thought, i've almost tried all

hollow swallow
#

no worries. How can i call something only on the host and not the client?

short arrow
#

Has authority node, or rpc call through an event

twilit radish
#

@torpid girder It certainly does execute "Development Server"

#

Try actually switching over your build target in VS in the top left instead of whatever "Quick build" may be.

torpid girder
#

right i've changed some log lines from error to warning, they should reflect if i quick build

#

ah, so i can't run a server and client on the same machine

#

i just saw i was breaking things

twilit radish
#

You definitely can unless you enabled something specific that disallows it. I just did it when I took that screenshot.

torpid girder
#

when i ran the server, it hooked into VS and i was able to hot reload it

#

not sure why it hooked in this time

#

sigh and i am still running the old binary

torpid girder
#

ah this is interesting, if you run "C:<YOUR INSTALL PATH>\Engine\Binaries\Win64\UnrealEditor.exe" "A:\MyProject\MyProject.uproject" -server -log from the project directory it connects to visual studio

green fjord
#

hey can i change the speed of packets sent between client-server for the movement replication?

wooden abyss
#

Hello, I have a question regarding rewards for players. In my TD game I have an event in my Gamemode thats called "RewardOnEnemyKill" which should give a base reward like gold to every player in the game. Each player has their own multipliers for gold gain based on a skill tree. Now I'm wondering where I should add this bonus to the reward. Should I add this "reward logic" to my Gamemode Event which just gets the bonus from the PlayerState? Or should I add this logic to the PlayerState and add a function AddReward that calculates the actual reward inside the PlayerState. But that would be some kind of reward logic and I'm not sure if I should keep this logic inside a PlayerState cause it should just be a data class. Does anyone have any tips or best practices for this?

potent coral
green fjord
#

hey can anyone explain me what is the different between MaxNetTickRate,
NetServerMaxTickRate,
LanServerMaxTickRate,
NetClientTickPerSecond,
MaxClientRate, and
MaxInternetClientRate

#

when i call rpc unreliable on event tick, does it will follow the tickrate speed or follow the game FPS speed?

prisma snow
twilit radish
#

I'm going to be honest, the net tick rate limit code is the most confusing thing I've seen all day 🀣

#

I know for sure that dedicated servers tick at the speed of: NetServerMaxTickRate
But I can not figure out for over 30 minutes now already what exactly limits or does not limit clients and also listen servers.

scenic turtle
#

Hey all, I would like to know what would be the best way to handle a client - dedicated server scenario
-Client downloads chosen character through Chunkdownloader and sets it as its pawn
-Another client downloads a different character through chunkdownloader
-They both join the dedicated server

  • Will they be able to see each other characters on the server map?
  • I think, not, and i would have to have something on the server that send some asset/ chunk ID to the connected users and they would download the other users missing character..
    -Or i am over complicating things?
twilit radish
#

Are you referring with "pawn" to an entire pawn class/blueprint or similar or a dynamically downloaded mesh? Big difference there.

scenic turtle
#

Mesh sorry

#

Well.. I mean pawn would be more ideal, as they are currently in their own separate blueprints, but if mesh is easier than probably i would go down that route

twilit radish
#

Both clients will need to download both meshes, Unreal does not replicate entire dynamic downloaded meshes and thus the clients don't know what to load otherwise. So yes, you'll need to let the server know "Hey, I'm using mesh X" then the server accepts that (or denies if not owned or whatever?) and lets the other client know "Player Y is using mesh X! Go download that mesh and apply it afterwards."

#

If you want to use completely dynamic pawns the server now also needs to download them as it has to spawn the actual pawns.

twilit radish
scenic turtle
#

The server will be packaged with all the list of possible pawns, and they should have the same collision as they are all technically the same characters with different meshes

#

But yeah, sadly i am not really expert on the topic and I only recently started to use ChunkDownloader

twilit radish
#

I don't really see why you're dynamically downloading meshes then though? Unless you have a set of certain pawns that can have an infinite amount of different meshes created by others or something?

#

Or is it something like DLC content?

scenic turtle
#

Hmm something like that Thom, because the idea is that after user logged in, they will receive a chunkID and based on that ID they download their character through ChunkDownloader. Then they join the Servermap, server will know about all these characters. But I am wondering how another client who will join the server with character model A will know about the other user's character model B vice versa.

#

Sorry if my explanation is not clear.

twilit radish
#

If you set a replicated variable on the server side pawn with which mesh was selected by the corresponding client then a new joining client will receive that and can also start loading the mesh.

scenic turtle
#

Can you please explain what do you mean by server side pawn?

twilit radish
#

As in the pawn that exists on the dedicated server.

scenic turtle
#

And if I would try to download different pawns? Would that be a completely different topic? Thanks for your help so far.

twilit radish
#

I must say that goes beyond me, I don’t know if the server can properly replicate a pawn that the client needs to still download.

#

Maybe by spawning it locally and trying to make it net addressable, but not sure honestly.

kindred widget
#

Are these majorly differing pawns, or are we talking cosmetic modifications like Fortnite skins?

scenic turtle
#

We can say like Fortnite skins.

scenic turtle
kindred widget
#

Would strongly recommend not doing anything outside of Unreal's normal networking. Lyra does this at least by replicating Character Parts through a fast array.

twilit radish
#

Creates own network protocol with custom dedicated server written in NodeJS >:D

scenic turtle
kindred widget
#

If memory serves, they just do a FastArray, and each one contains a pointer to a ChildActorComponent. I know the stigma around them, but it's actually a pretty decent approach. Even the character's Manny/Quinn mesh is one of these.

twilit radish
#

The last time I used child actors my project didn't work in a packaged build any more lol.

kindred widget
#

I mean to be fair you can do the same thing yourself with normal attached actors. But I assume if they're using it in Lyra, possibly in Fortnite, they've probably fixed some bugs on them.

twilit radish
#

Could be, this was back in 4.26 or so I think.

#

So it has definitely been a while πŸ˜„

#

Cedric is about to either ask the most complicated question of the day or about to correct someone who was wrong πŸ˜‚

thin stratus
#

Has anyone solved a setup like this before?

A "main" Character that is representing a Player, so if it dies it would count as actual Death (Score wise).
And a "remote-controlled" Character that the Player can temporarily control while the main Character stands still.

And handling that main Character being affected by things and even dying while controlling a different Character.
The issue is that I need to possess the other Character, but I still need the main Character to be handled as being controlled.

If I don't do anything, then the main Character will be unpossessed, and possibly counting as SimulatedProxy for the Player (even locally).

#

wow Thom, wow

#

Hope you can answer this for being such a nice person

twilit radish
#

It was not meant to be rude, sorry if that come over like that πŸ˜…

thin stratus
#

All good :P

#

I struggle with this, cause I have GameplayAbilities that are set to predict to execute locally first.
But if the main Character is not possessed then those will fail the NetRole check.

#

I could possess it with an AIController in the meantime, then it would probably execute the GameplayAbility on the Server.

#

But then it would nuke the Controller and PlayerState pointers

#

And killing it would not count as a Death to that Player anymore

twilit radish
#

What exactly would be the problem with temporarily nuking the pointers though? Worst case you just keep a weak reference to the appropriate controller I guess. But trying to truly posses two pawns at once seems like a nightmare.

#

Could just implement a getter for both the player state and controller that first checks if there's no 'override' and otherwise just grabs the actual owner etc.

#

A random other thought would be to perhaps spawn two player controllers with the same owner? I don't know how well that works, but in theory it's pretty much what splitscreen does.

kindred widget
#

Wonder if you could override the player pawn's Unpossessed, and not change ownership or controller, or playerstate? Wondering what would happen if you just left those as is while possessing the other pawn. Have not tried.

twilit radish
#

Why I didn't want to suggest that is because there are internal references to both from each other, player controller references pawn while vice versa is also the case. Then you need to also fix up those links which I'm not sure is as great either.

thin stratus
#

I'm also a bit hesitant on those wrapper getters cause we already have a big project with tons of calls to the native getcontroller/getplayerstate functions

oak oracle
#

hey devs , asap question , i got float variable and passing it trough Client RPC but when rpc runs passed value is got reset , as you can see on scneeshots before to send in to the RPC its 130 but after it reached RPC its 0 , any ideas why ?

thin stratus
#

Can you progress one step further so the break is on the cast node and see if the float value changes?

#

Also you are calling a CLIENT RPC on the GameState

#

That will not work

#

GameState can only process MULTICAST RPCs and only on the Server (by definition of Multicasts)

#

CLIENT RPCs require the Actor to be owned by a specific Client

#

Which GameState is not

oak oracle
thin stratus
#

Yes

oak oracle
#

wow, it teached me a lot , awesome article πŸ‘πŸ»

thin stratus
#

(: glad it helped

twilit radish
#

You can override the PreLogin in gamemode if you just want to print it or something, but I don't see any exposed BP functions that allow you to access it.

wooden abyss
#

Hello, if I'm trying to handle rewards for players in a multiplayer game in the Gamemode BP by giving every player a base reward, but that reward gets multiplied by an individual multiplier for each player, should I do the multiplication inside the Gamemode as well? Or should I do that in the PlayerState where I have the actual currency variable and the multiplier?

Like this...
Calculating the actual reward in the Gamemode and only saving/adding the correct value to PlayerState

#

Or maby like this...
Calling a function from PlayerState that takes in the base value and calculates/saves on its own

#

Second option would have "logic" in the PlayerState. Not sure if thats ok or if i should just keep this in the Gamemode

kindred widget
#

It's odd that each player gets a different multiplier.

#

But generally speaking I would keep all of this in the game mode. Should be part of the calculate function.

spark igloo
#

Hi guys,

I have been working on Linux dedicated server size optimization but I tried to exclude debug files and pakbaklist to remove unsed content gng into server build. But still the generated build is 120MB. How can I reduce it ? Engine Binary files are taking about 110 MB how can I optimize the memory here

wooden abyss
#

Alright I will try to keep it inside the Gamemode then. Thanks for your input @kindred widget

real ridge
#

Guys I have one question i have stored values here in player state when I open my game etc but when I join session all these things are getting like removed and I dont have it there anymore how I can restore them?after joining session

#

and I cant use seamless travel as it is just joining session from online menu not from server to server

#

I have easy login where I put for example Kamil Kamil it will log me save name there + team etc and then I hit play it will join session and its empty

wooden abyss
#

If you dont use seamless travel your playerstate is lost between levels i think

#

You could use the GameInstance to save whatever you need to persist between level changes

real ridge
#

Login (offline)->Menu(offline)-Here is data lost->play(online)

wooden abyss
#

Well then you can still use the GameInstance to store the info you need and then read them whenever you have that transition

real ridge
#

I am doing login via varest

real ridge
#

and change it

wooden abyss
#

As the GameInstance exists for each client: yes they could

real ridge
twilit radish
#

If you're going to store data like teams on the client side then you should change your approach regardless if you care about cheaters.

real ridge
#

anyways client have also access to player state

#

so how then

twilit radish
#

Having access to some data versus being able to store that data on the client and expect it to be used again is a totally different story. If you don't want clients to be able to cheat you will want to keep the data on the server. You can for example get their unique id and store data along with that in the server game instance or as a file somewhere to persist throughout game restarts.

real ridge
#

so if I store something in player state? then me as player cant access it ? because I can access it from server and client too

#

then what is game instance good for

#

if i take case that client can cast to playerstate then also can hack it

twilit radish
#

The player state is shared across all clients correct. The game instance was an example as it persists throughout the entire lifecycle of a game, if you change the level it still exists.

real ridge
#

i know

#

but then its not usable for MP

#
  • also if I just store value in player state and have variable lets say TEAM there and dont multicast it then its stored only locally for client not for server than obviously I can hack it no?
twilit radish
#

But what's the point of storing a team locally in the player state if you're not doing anything with it on the server? Also you can very much use the game instance in multiplayer, just because it can't make network calls it self doesn't mean it's not useful and again it was an example as you were asking for ways to store data for longer than a single level.

real ridge
#

sorry if I am talking shits just want clarify it

real ridge
#

so all things which I want to be not editable by player should be stored in player state yea?

#

also then what if I have pawn which is AI and it has variables these should be in playerstate too? but it doesnt have playerstate as its only AI pawn

twilit radish
#

That's not what I'm saying whatsoever. Like I said, if you want something to be away from the client you should keep it server side. You can share the data with them through the player state, that's completely fine. But don't store the data on the clients side and then have them later on send that to the server as that will allow for cheats. You would instead persist that data on the server through 'something' capable of doing that and then when needed use that data that the server stored again so it doesn't have to come from the client.

#

The golden rule in terms of cheating is very simple:
If a client can send over the data then that specific data can be manipulated by someone. Don't ever just assume it's safe. Unreal does do some validation with certain stuff already, but by far not everything.

real ridge
#

okay and my last question

#

How I know client cant access player state variables and change it

#

IF

#

I have stored things there

#

and I am for example not multicasting their storage

twilit radish
#

It can't. A client can not magically change variables in the player state on the server. It will have to make a request to the server with "I want to change this data" which can only be done if either Unreal provides a way for it or if you make a way your self. If you do provide a way and don't properly deal with that request or can't properly deal with it then it becomes an issue.

real ridge
#

also if I understand right till variable is not set replicated server doesnt know about it,/not sure if I have also use set via multicast to store it on server

twilit radish
#

A multicast can only be called from the server. So at that point you're already on the server.

real ridge
#

hm I have mess in it

#

in singleplayer games you also have playerstate but there is no server it means then there you can hack those data?

twilit radish
#

You can't possibly protect data in singleplayer, correct.

real ridge
#

and thats why I dont understand it ahhh

#

πŸ˜„

twilit radish
#

Singleplayer games happen on someone's device, you do not control that device. If someone wants to do something to their game they can do so because nothing stops them from doing so.

latent heart
#

Unless it's like stadia and played remotely. Do not be stadia.

twilit radish
#

And that's exactly why cheats exist in multiplayer games, you do not control the device people play on. If you make a RPC from client -> server that allows someone to change their nickname as an example then they could in theory change their name to whatever they want it to be because they own the device where that data comes from. A regular user won't do this, but a cheater could if they wanted to.

That's why like I said you keep data on the server that you don't want clients to be able to change. They can't magically manipulate server side data.

real ridge
#

but imagine my situation till I Join session (arena) my game is offline and all things are in player state /stored then I want persist that data to my session yes? but if you saying in singleplayer I can change data then someone before joining game can change his TEAM or name in player state (possibly hack game) and after joining game he will have another name + team
SO how to protect from this?

twilit radish
#

You don't. The moment it's offline they can do everything to it they want to. You can't expect that data to not be changed if a cheater wants to.

wheat niche
#

hey, i implemented multiplayer and i want to simply send a message to all players OnLoginPost. The problem is that it gets only called server side i created a custom event that is replicated multicast and then print something but i just prints for the server does anyone have an idea how to solve it

dawn ledge
twilit radish
real ridge
#

i am lost

wheat niche
#

so what i did is i added the OnPostLogin event inside my gamemode and then i created a multicast function inside my gamestate is that correct=

#

?

twilit radish
#

If you expect to import data from single player then there's indeed no way to prevent cheaters. @real ridge

hushed heart
#

Hello! Apologies for interrupting, I have what's likely a bit of a scrubby question, but hopefully quite quick to answer. I know that OnRep functions will let clients know when one of my properties is replicated down to them. Is there way to get an OnRep for transform-related stuff? Like an OnRep for my clients when they receive a new actor location?

latent heart
#

The only way is to heavily validate imported data.

real ridge
#

so till i join session

#

i am "offline"

latent heart
#

E.g. you check if osmebody says they have 2000000 rounds for their pistol, you ban them.

twilit radish
real ridge
#

this is too hard theme

#

hah

#

but thanks for talk

#

I am more confused as I was

#

:DDDDDDDDDDDDDDDDD

twilit radish
#

@real ridge TL;DR there's no way to prevent people from changing data that comes from a singleplayer/offline mode and is then sent to a server.

#

There just simply isn't a solution to that.

#

If you want it to be cheat proof, don't send the data from the client to the server, if that's not an option then you'll have to live with that being an option to cheat.

latent heart
twilit radish
#

Which is exactly my point, you can't know what is valid data or not. Maybe a new player has 500 coins to name an example, but perhaps someone that played the game for years has 50.000.000 coins mean while. If you "guess" it could only have been 20.000.000 and ban them for it then you're getting rid of innocent players which is why it's just really bad to do that.

#

Also speaking of security stuff, does anyone know if Unreal checks for NaN/infinite floats/doubles?

#

I'm kind of guessing it doesn't right?

latent heart
#

It does in dev, not in shipping, I think.

twilit radish
#

πŸ€”

latent heart
#

It's checked in TVector somewhere, I think, if you want to check the conditions.

twilit radish
#

Thanks, will take a look in a bit πŸ‘

lost inlet
#

I would doubt there's any implicit checking for NaN/inf for RPCs/replicated values

latent heart
#

There's checking when it converts between types. vector to rotator etc

#

#if ENABLE_NAN_DIAGNOSTIC || (DO_CHECK && !UE_BUILD_SHIPPING) with these conditions

#

And when those types are assigned/created

#

It's basically everywhere.

twilit radish
#

That one feels to be more related to debugging though.

frank birch
#

Where should I create my widgets? I wired myself to the begin play of a custom HUD class but I am getting an error that Blueprint Runtime Error: "Accessed None trying to read property CallFunc_Create_ReturnValue". Node: Add to Player Screen Graph: EventGraph Function: Execute Ubergraph HUD Ready System Blueprint: HUD_ReadySystem (only happening on dedicated server, listen server doesn't error)

Where should I create my widget and append to screen? πŸ€”

gloomy tiger
frank birch
#

but they do have HUDs? πŸ™ƒ

gloomy tiger
#

I guess so.

#

I don't remember exactly, tho

#

What you can do is checking if it is locally controlled

#

A lazy solution though

frank birch
#

Yeeeep, dedicated server has a HUD πŸ™ƒ
well, locally controlled should be okay 🀞

gloomy tiger
frank birch
#

server is returning true πŸ™ƒ

gloomy tiger
frank birch
#

dedicated

gloomy tiger
#

When you say 'dedicated', what exactly are you talking about?

twilit radish
#

That's not a dedicated server if you can see the message.

gloomy tiger
#

Yes

#

If this is what your NetMode looks like, you're not running on a dedicated server

gloomy tiger
#

✨

#

That's not dedicated.

frank birch
#

ohhhh πŸ€”

twilit radish
#

Honestly "as client" is confusing as heck because it does run a dedicated server if you go standalone.

gloomy tiger
#

(I mean, not the naming thing, but not spawning a dedicated server when two instances are clients)

twilit radish
#

You can launch a dedicated server through the command line from the uproject.

#

Oh like that. Well sure, but that it's different when not running standalone is weird.

frank birch
#

ok, but then what can I use to ask "does this thing has a screen?" πŸ€”

gloomy tiger
#

Though isn't this "dedicated server" lifted by standalone game a listen server simulation?

gloomy tiger
gloomy tiger
twilit radish
#

If you can see the message being printed it's a listen server because dedicated would not show that message as far as I know as it needs to be a separate process.

#

But I'm not 100% sure, but it makes absolutely no sense to not be a listen server.

#

πŸ˜„

gloomy tiger
gloomy tiger
twilit radish
#

You don't want to ignore the listen server though because then that one has no UI.

gloomy tiger
#

What's weird though - is your HUD marked as Replicates?

gloomy tiger
frank birch
#

hud never replicates, it can't. 300% sure of that

gloomy tiger
#

Ideally though - if you're aiming a dedicated server, you should setup things right

gloomy tiger
twilit radish
#

That's why this makes no sense in the first place because HUDs indeed don't spawn on dedicated servers. Don't ask me how they spawn on listen servers though as they use GetNetMode() == NM_Client.

gloomy tiger
#

Don't ask me how they spawn on listen servers though as they use GetNetMode() == NM_Client.

Is this legit? 😐

gloomy tiger
#

If that's legit, unless the server instance is a client itself - which I'm quite sure it's not - I mean, I find myself clueless.

twilit radish
#

The server is not a client, I can pretty much tell you that.

#

But once again, they weren't running as a dedicated server. That's the whole problem with this.

gloomy tiger
#

It's controversial then

#
    if ( GetNetMode() == NM_Client )
    {
        SpawnDefaultHUD();
    }
#

@frank birch are you spawning a hud yourself?

#

Or just replacing the default one?

azure cape
#

I got a very weird issue :

I'm overriding OnBecameViewTarget in my character
this character calls a function which, at some point, checks if the player is locally viewed
When the player first becomes the view target, IsLocallyViewed returns true if the player is playing offline or is the host
however, if the player is a client, OnBecameViewTarget gets called twice for some reason, and both times IsLocallyViewed returns false
Checking IsLocallyViewed after that returns the correct value however
IsLocallyControlled is always correct regardless of if it's checked on the host or client though

frank birch
#

oh, you gonna love this
(Play as Listen Server and Play as Standalone returns false, Play as Client returns true πŸ‘€ )

gloomy tiger
frank birch
gloomy tiger
thin stratus
#

Play as Client is meant to be a Dedicated Server environment.
One can argue that it might not be a separate process, but code and branch and whatever wise this is a dedicated server

#

And print strings are very much visible in client windows in pie when printing on servers

#

Even draw debug 3d stuff is visible cause epic multicasts those

twilit radish
#

With a listen server yes. But you can't possibly run a dedicated process inside a client as that's not a dedicated server?

#

That's just a listen server πŸ€·β€β™€οΈ

gloomy tiger
#

Regardless of that

thin stratus
#

Play as Client is not a Listenserver

frank birch
#

But then... why is my "not-so-dedicated-server" spawning a HUD object? πŸ€”

gloomy tiger
frank birch
#

ok, found it πŸ€¦β€β™‚οΈ

#

I was creating a local player on my GM πŸ€¦β€β™‚οΈ

thin stratus
#

Also

#

For the ListenServer HUD question

#

The line you looked at with the NetMode

#

Is not what spawns the HUD for the ListenServer

#

Not sure if that was clear

twilit radish
#

I was meanwhile also looking at where it could spawn specific for a listen server, but I didn't find anything so far. Where does that happen?

thin stratus
#
void AGameModeBase::GenericPlayerInitialization(AController* C)
{
    APlayerController* PC = Cast<APlayerController>(C);
    if (PC != nullptr)
    {
        InitializeHUDForPlayer(PC);
void AGameModeBase::InitializeHUDForPlayer_Implementation(APlayerController* NewPlayer)
{
    // Tell client what HUD class to use
    NewPlayer->ClientSetHUD(HUDClass);
}
void APlayerController::ClientSetHUD_Implementation(TSubclassOf<AHUD> NewHUDClass)
{
    if ( MyHUD != NULL )
    {

        MyHUD->Destroy();
        MyHUD = NULL;
    }

    FActorSpawnParameters SpawnInfo;
    SpawnInfo.Owner = this;
    SpawnInfo.Instigator = GetInstigator();
    SpawnInfo.ObjectFlags |= RF_Transient;    // We never want to save HUDs into a map

    MyHUD = GetWorld()->SpawnActor<AHUD>(NewHUDClass, SpawnInfo );
}
twilit radish
#

ew

#

πŸ˜‚

thin stratus
#

That's also the function I usually use to spawn my UMG HUD

#

Cause BeginPlay can't be reliably used

#

Also you should have noticed that SpawnDefaultHUD is not the correct function, as that has no idea what Class you selected in the GameMode :P

#
    /** Spawn a HUD (make sure that PlayerController always has valid HUD, even if ClientSetHUD() hasn't been called */
    virtual void SpawnDefaultHUD();
#

That's mainly due to HUD having a shit ton of debug draw stuff in it I guess

twilit radish
#

Ok that's definitely my fault for not thinking that through πŸ˜‚

#

I was like "spawnactor<Ahud>" - that probably checks out.

thin stratus
#
/** The editor will act as a Client. A server will be started for you behind the scenes to connect to. */
PIE_Client UMETA(DisplayName="Play As Client"),
frank birch
thin stratus
#

Cause it doesn't call if you ServerTravel from Map A to Map B and both use the same PlayerController class

#

Cause the PlayerController will just persist

twilit radish
#

In my defence Cedric, "suddenly" having ahud supposedly on a dedicated server definitely made me question "as client" lol.

frank birch
#

ohhhh, riiiiight 😰
with AGameMode that instead of "swapping" it somehow survives the old controller, right?

thin stratus
#

Always question the person trying to make you believe the DediServer has a HUD :D

gloomy tiger
twilit radish
#

That's exactly what I did. And that's why I thought it wasn't a dedicated server. I did indeed not think of it being a player being spawned inside the game mode 🀣

frank birch
twilit radish
#

Pulls up Wizard's blog

frank birch
gloomy tiger
frank birch
#

I am living on eXi's guide and the wizzard blog πŸ˜…

twilit radish
#

πŸ˜„

thin stratus
#
// Standalone requires no server, and ListenServer doesn't require a separate server.
        const bool bNetModeRequiresSeparateServer = NetMode == EPlayNetMode::PIE_Client;
        const bool bLaunchExtraServerAnyways = InRequestParams.EditorPlaySettings->bLaunchSeparateServer;
        const bool bNeedsServer = bNetModeRequiresSeparateServer || bLaunchExtraServerAnyways;

        // If they require a separate server we'll give the EditorEngine a chance to handle any additional prep-work.
        if (bNeedsServer)
        {
            // Allow the engine to cancel the server request if needed.
            FGameInstancePIEResult ServerPreCreateResult = PreCreatePIEServerInstance(
                ErroredBlueprints.Num() > 0, false /*bStartInSpectorMode*/, PIEStartTime, true, PlayInEditorSessionInfo->NumOutstandingPIELogins);
            if (!ServerPreCreateResult.IsSuccess())
            {
                // ToDo: This will skip client creation as well right now. Probably OK though.
                UE_LOG(LogPlayLevel, Warning, TEXT("PlayInEditor Session Server failed Pre-Create and will not be started."));
                return;
            }

            // If they don't want single process we launch the server as a separate process. If they do
            // want single process, it will get handled below as part of client startup.
            if (!bUserWantsSingleProcess)
            {
                const bool bIsDedicatedServer = true;
                const bool bIsHost = true;
                const int32 InstanceIndex = 0;
                LaunchNewProcess(InRequestParams, InstanceIndex, EPlayNetMode::PIE_ListenServer, bIsDedicatedServer);

                PlayInEditorSessionInfo->bServerWasLaunched = true;
            }
        }
twilit radish
#

Sneaky in the background then smh.

thin stratus
#
            // Create the instance. This can end up creating separate processes if needed based on settings.
            // This code is separated out of here so it can be re-used by the Late Join flow.
            CreateNewPlayInEditorInstance(InRequestParams, bRunAsDedicated, LocalNetMode);
gloomy tiger
#

Also

thin stratus
#
        // Fixed tick setting
        if (InRequestParams.EditorPlaySettings->ServerFixedFPS > 0 && bInDedicatedInstance)
        {
            PieWorldContext.PIEFixedTickSeconds = 1.f / (float)InRequestParams.EditorPlaySettings->ServerFixedFPS;
        }
#

Things you find..

twilit radish
#

Ew.

gloomy tiger
#

The server indeed had a HUD, so sue me. lol

twilit radish
#

But why on earth would you ever expect a dedicated server to have a player?! 🀣

gloomy tiger
#

Not the server itself, but its local instance has a PC.

twilit radish
#

Nothing is ever going to make me even think about that someone may have spawned a player inside the game mode lol.

thin stratus
#

I think they aren't actually starting a Dedicated Server

#

The Editor is a Dedicated Server

#

Basically the PIE Session is marked as DedicatedServer and will then skip creating some things

twilit radish
#

Actually.. That makes a lot of sense.

thin stratus
#

And the Client is an additional window, same as if you play as a ListenServer

twilit radish
#

I was running Unreal Insights not too long ago and the editor was also considered part of that after I added the custom launch parameters.

gloomy tiger
twilit radish
#

Wdym?

twilit radish
#

Honestly, I don't even want to think about it any more. My brain can't handle this x)

thin stratus
gloomy tiger
#

Argh lol

thin stratus
#

I still need to figure out my main Character + other Character issue.
I don't want to.

#

Multiplayer is so not fun if you have a Designer that actually doesn't want to create standard UT.

gloomy tiger
thin stratus
#

Actually, now that I mention UT, how do they do the redeemer

#

BRB

gloomy tiger
#

Probably not as bleeding edge as yours but hey

#

Good luck

twilit radish
#

What's your scenario?

#

(If you can tell I guess)

gloomy tiger
#

Ah, I have a TSoftClassPtr<xxx> in a UDeveloperSettings

#

When I boot the editor, it does not work first time (null reference) - but if I just go to the actual Project Settings menu and re-select the class I selected before and play it again, it works

twilit radish
#

πŸ€”

thin stratus
#

The thing you select

#

Is that in a different Module?

#

Cause I had that issue when I was referencing something from a different module, and the variable initialized before the module loaded so it couldn't find the asset

gloomy tiger
#

I mean, not really sure. It's just a class within my project.

#

I open my editor, this is how the settings look like. I click play. It doesn't work (nullptr)

thin stratus
#

For me it was a class coming from a plugin

gloomy tiger
#

If I just select None and put W_Cheats again, it works (not nullptr anymore)

thin stratus
#

But it loads with W_Cheats?

#

Or is it visibly none when starting the editor

gloomy tiger
#

Oh, sorry yes

#

It loads with W_Cheats

thin stratus
#

Since it's Soft Class, are you loading it anywhere?

gloomy tiger
thin stratus
#

That would explain why it works after you actively select it

#

Which probably loads it

gloomy tiger
#

Is it safe to say that load on select happens syncrhonously?

#

I know I'm asking too much but just in case you know it from the top of your head...

thin stratus
#

I assume so

#
bool AUTRemoteRedeemer::DriverEnter(APawn* NewDriver)
{
    if (Role != ROLE_Authority)
    {
        return false;
    }
    if (Driver != nullptr)
    {
        DriverLeave(true);
    }

    if (NewDriver != nullptr)
    {
        CurrentFuelTime = MaxFuelTime;
        Driver = NewDriver;
        AController* C = NewDriver->Controller;
        if (C)
        {
            C->UnPossess();
            NewDriver->SetOwner(this);
            C->Possess(this);
            AUTCharacter *UTChar = Cast<AUTCharacter>(NewDriver);
            if (UTChar)
            {
                if (UTChar->GetVelocity().IsNearlyZero() && UTChar->UTCharacterMovement)
                {
                    UTChar->UTCharacterMovement->AddDampedImpulse(FVector(0.f, 0.f, 4000.f), false);
                }
                UTChar->StartDriving(this);
                UTChar->PlayerState = PlayerState;
            }
            DamageInstigator = C;
        }
    }

    return true;
}

#

Also, I'm disappointed

#

They do the same thing I do

#

But they don't have GAS back in UT times

#

sigh

#

Maybe I just have to check if the Character is possessed or not and based on that change the Prediction Enum on the GA

#

Or just have a Child for non-possessed Actors

#

AController* C = NewDriver->Controller;
if (C)

#

Also please don't do that

#

Freaking C

gloomy tiger
#

C lmao

thin stratus
#

Ya well, guess 2 GAs it is

#

F*ck it

#

Back to building non-lego brick F1 car

hushed heart
#

Hello! Apologies for reposting, I have what's likely a bit of a scrubby question, but hopefully quite quick to answer. I know that OnRep functions will let clients know when one of my properties is replicated down to them. Is there way to get an OnRep for transform-related stuff? Like an OnRep for my clients when they receive a new actor location? Thank you!

twilit radish
#

Nevermind, that was totally not what it was supposed to be πŸ˜…

crisp sable
#

Let's say I have Player A running a listen server and Player B connected to the server

If player B triggers a level streaming volume, will Player A also load the streaming level that player B just triggered? Or do I need to add some extra code to tell the player A to load the level.

The reason I need player A to load the level is because he needs to have the collision information loaded for the streamed Level or else player B will fall through the world.

Is this all done automatically in ue4.27? Or do I have to add extra code to handle this?

low helm
#

I believe the intended framework would be for you to load all the levels on the server, probably at all times

#

Or maybe try to do it simultaneously

crisp sable
#

Ah I see..

low helm
#

But no I don't think any of that is done automatically for you

crisp sable
#

So have the listen server load all sublevels

#

And the client will just load the sublevels when he triggers them

low helm
#

Yeah if your server memory can handle it then do it that way

#

Also has rendering implications on the server

#

Which makes me wonder if you can load a level without making it visible, but the collision is still there

crisp sable
#

Yes the listen server would have to have a lot of memory or somehow I can figure out how to only load collision

twilit radish
# hushed heart Hello! Apologies for *reposting*, I have what's likely a bit of a scrubby questi...

To properly answer. There are several methods you can override within C++ from the actor:

/** ReplicatedMovement struct replication event */
UFUNCTION()
virtual void OnRep_ReplicatedMovement();
/** Update location and rotation from ReplicatedMovement. Not called for simulated physics! */
virtual void PostNetReceiveLocationAndRotation();
/** Update velocity - typically from ReplicatedMovement, not called for simulated physics! */
virtual void PostNetReceiveVelocity(const FVector& NewVelocity);
/** Update and smooth simulated physic state, replaces PostNetReceiveLocation() and PostNetReceiveVelocity() */
virtual void PostNetReceivePhysicState();
```Note that if you use the OnRep you need to check if it's actually replicating movement as apparently there's something whacky about that according to some comments inside of it.
low helm
#

I tend to just turn on client authoritative movement, so I can just do whatever I want on the client and the server just trusts, nobody has bothered to hack my games yet

#

But that's partially because I never released them

hushed heart
#

And hah, that was to be my last resort, just trying to build in some good habits

low helm
twilit radish
#

Tbh the default actor position replication system is not great. So no, not really.

#

If we're talking characters then yes, you're reinventing the wheel.

hushed heart
#

I am not, really, that's a project for the future for sure. Gosh I sure would love to just use the Character Movement Component but it's not suitable so I'm doing some terrible terrible things to navigate around it. It's just for a small project so it's not a big deal

#

Since my pawn is wider and broader than it is tall, the blasted capsule restriction is the only thing stopping me from using the CMC, alas

#

If there's a way around that with the CMC I would super love to know! But I think there isn't, unfortunately! If I could just use a fat capsule, that'd be great, ahaha.

twilit radish
#

Without modifying the engine source code no.

#

It's definitely annoying that it doesn't easily allow this though.

hushed heart
#

It's super annoying! I wonder if it would break if I went into whatever source code prevented the capsule's half-height form being smaller than the radius.

#

Something to try later perhaps, I don't need it to be super amazing quality right now. I find it super weird that, out of the box, there's no convenient way of having clean networked movement if you don't want a standard capsule collider.

#

Thanks for the help, though! Much appreciated.

vagrant grail
#

What's the difference between using a "has authority" node and putting your code on server side with a custom event server sided ?

latent heart
#

HasAuthority will only run if you're already on the server.

#

A server side event will only be triggered from the server or be sent to the server if run on a client-owned actor.

serene furnace
#

Hello I have a question about a weird issue that I have,

I'm running some testing into a Listen client server that is running 2 clients and the server.

The issue I have is that some clients dont even spawn sometimes, they stay "stuck" and dont possess / spawn a pawn, my code has been working since beggining of my project and never got changed

vagrant grail
serene furnace
#

moving the spawn looks to be making it a bit better, but verry not a real a solution

torpid girder
#
LogNet: Error: ReceivedRPC: ReceivePropertiesForRPC - Mismatch read. Function: ChooseCharacter_Server 

could this mean the client code and the server code are out of sync?

thick jungle
#

question time... my player's characters DO replicate their rotation, but not their position. For example, if I execute the Jump command server-sided, neither client sees it happen.. I'm guessing I'm missing a setting somewhere?

latent heart
#

That's why you have to ask.

#

Obviously if it's run on a server-only object, like game mode, it will always be true, but there are many, many circumstances where you have to check.

vagrant grail
latent heart
#

I don't know. Maybe? Depends on your game.

surreal niche
#

Hello people

vagrant grail
latent heart
#

I will tell you, that code will run on the server and every client. It will be executed locally on all of them.

#

Just do it on the client as well. You can always validate if you're in the right zone when you tell the server you're doing things.

vagrant grail
thick jungle
#

if you wanna be save and understand what's going on, I'd suggest server-side that bit of code

#

that way all related code will only be done server-sided and therefore at least always be identical for everyone

latent heart
thick jungle
#

if your server has authority over this object? yeah

vagrant grail
#

If someone joins mid game will he receive the right state of the "IsEnabled" boolean ? Or should that boolean be a repnotify ?

fossil spoke
#

RepNotify is just a function that triggers when the value of that variable changes via replication.

latent heart
#

"All"

#

Those that are chosen to be passed down.

serene furnace
#

Any ideas for my issues ? πŸ€”

thick jungle
twilit radish
#

@serene furnace I would recommend you check the logs, perhaps something in the map moved and blocks a spawn. Usually the engine will notify you of why a pawn can't spawn or similarly will tell you if something is wrong πŸ™‚

torpid girder
#

novice question, when your dedicated server creates a session and you give it a name, should it be unique?

#

the examples are hardcoded text

serene furnace
fickle igloo
#

Heyo, is there any resource/guide/best practice for non-exploitable, client-predictable, RNG in multiplayer? Something like how auto-attack crits might be dealt with in a MOBA (all clients can predict the crit happening, but still server authoritative).

noble sentinel
#

Im using this for multiplayer connections but it isnt working, Im using spacewar appid with developer build, not shipping

#

What can be the problem?

hushed heart
#

Hello! Sorry to pop up here again, weird question just in case anyone might have experienced this before. I have replicated movement working fine hip hip hurray, for now it's on a Listen-Server. The only issue is that, for some reason, the listen-server client's pawn moves incredibly slowly. i'm setting it using AddMovementInput in server-only RPC, and noticing tht it considers its velocity to always be zero, so something is causing it to reset back to zero again. Using 2 clients, the other one works absolutely fine. It also works fine if I switch to a dedicated server, which I may just end up doing.

Don't worry, this code doesn't have to be super pro and shippable, it's just my own messing around, but I'd love to know what's going on as I seem to have exhausted my leads. Any help would be great, thank you!

ocean dust
#

Hello, all. How would I uniquely identify a newly-connected PlayerController? I want to spawn in my players when they connect, but only onto PlayerStarts that have not already been assigned to other players. However, there doesn't seem to be a way to assign PlayerStarts without custom code and no way to identify PlayerControllers relative to the others in the server (such as "this is Player1 (who is also hosting), and this is Player2 (a remote client), and so on") such that I can easily spawn them where the they need to be when the game starts. Is there some functionality I am missing or is there a canonical way to do this?

river hazel
#

There is a function that is responsible for choosing a playerstart..i think on gamemode? I think you would have to track which have been used with by holding onto an array of the used ones or something...but it's a pretty common thing, you might spawn a team near each other or have different sets of player starts for different modes.

You should be able to use hasauthority to tell the difference between the listen server and remote clients.

ocean dust
#

Seems like the answer is "custom code and lots of loops"

sinful tree
#

You would assign the incoming player controller the identifier that you wish during OnPostLogin. You'd then override ChoosePlayerStart and read your custom player controller and read the identifier you've assigned.

twin juniper
#

It can be pretty easily done from the HandleNewStartingPlayer event in your game mode. From there you would have a variable called PlayerCount or something similar. Check if the player count is even, then assign it the appropriate spawn location.

#

Oh and then obviously increment the player count variable

grand kestrel
#

I have some glaring issues; this is PIE as a client without any artificial latency and have 100ms ping, and then the concerning ActorChan_FindOrCreateRep count. I could use some advice on where to start with debugging this to find the culprit(s)

ocean dust
twin juniper
deep shore
south crest
#

why if i turn on simulate physics for the character mesh (replicated component), it collapses like a ragdoll on the server how i want, but on the clients the character collapses like a stiff wooden plank? i dont need to sync the physics but just make the ragdoll happen on all clients...

thin stratus
#

Replicating the Component doesn't mean the Physics Boolean automatically replicates

hollow swallow
#

Would anyone have a chance to help me resolve an issue. When i start a game, the clients can move / look around, but the host cant. He can still see the other players moving around but its as if he has no input at all

#

That is on the player controller

#

and that is on the game mode

thin stratus
#

Why the RPC though

#

Wouldn't it make more sense to just limit BeginPlay to Authority and then directly talking to the GameMode?

#

Also the GameMode already has a lot of good overridable functions to handle customizing the spawning of characters. If all you want is automatically spawn a character at a location for a player then there is no need to do it manually

#

For the "no input" part. Are you setting InputMode anywhere?

#

Are you sure your Server properly set Game only input mode?

#

@hollow swallow

hollow swallow
# thin stratus Why the RPC though

Hey mate, i am really new to unreal, this is my first project. I have done it this way from a video tutorial series i am following. I have checked all the blueprints and they all seem to match up. How can i check that the server is set to game only input mode?

#

just using the listen server in the project at the moment

#

i tried adding set input mode game only after the possess. still no difference

thin stratus
#

Always annoying when video tutorials teach random stuff like that

#

Your server gets a character though, right?

#

Are any of the inputs for the server character triggering?

#

You could try disabling your spawn code and just setting your character as default pawn in your gamemode defaults

#

To check if it's your spawn code or not

#

@hollow swallow

hollow swallow
#

Yeah the character is spawning in. No input seems to be triggering for him though. ill try that now

#

Yep that works fine

#

and im 99% sure my code is identical to the tutorial (which is only 5 months old if that matters?) and it works fine on his

#

thats a screenshot from the video of his one

thin stratus
#

Man this is such a redundant thing to set up

#

GameMode has override functions for retuning a spawn point for the default pawn to spawn at

#

The transform returning node there is not really needed here.

But anyway, let's have a look at the code

#

What about the Default pawn you set in the Gamemode, was that empty before? Is it empty in the tutorial?

#

Is there any character in the scene already before pressing play?

#

Can you also try to change your PlayerController code to use

BeginPlay -> SwitchHasAuthority -(Authority)> GetGameMode -> Cast -> SpawnPlayer

?

#

So basically cutting out the rpc

#

@hollow swallow

hollow swallow
#

yeah im not sure, as i said this is my first unreal project so still pretty noob xD default pawn class is set to none in the game mode and in world settings, same as the video. There is no character in the scene only the player start locations. i will try changing the player controller now, 2 secs

#

That also doesnt work, same issue

vagrant grail
#

Does anyone know why my timer doesn't the clients but works for the server even if the timer is a component inside my Game State and started by the GameMode

deep shore
#

I’m trying to wrap my head around network optimization. I’m a bit confused about the relationship between network performance and CPU performance. Suppose an actor has a net update frequency of 100, when 10 would be enough. This is putting unnecessary stress on the network, but is it also having a negative impact on the CPU?

prisma snow
twilit radish
#

It’s not necessarily bad for the network to have a high update frequency (but definitely could be), Unreal will simply prioritize that actor more and may thus check more often if anything like the replicated variables changed. It does not send out random network data if it doesn’t have to. But why this becomes a CPU waste is because you’re now constantly checking that actor while if it as an example only has a few variables that don’t change often it’s unlikely to send any data over the network. Hence why you need to consider what priority you want actors to have.

grand kestrel
upbeat basin
peak sentinel
twilit radish
peak sentinel
grand kestrel
#

Its constantly the case

#

And its this one specific project, I tested others moments apart

#

Also it's a localhost connection ^^ there wont be spikes unless like you say, emulation settings are used; other projects are fine

buoyant kelp
#

I called a multicast function and just server executed it, as well as that when Client 1 picked up the weapon, Client 2 couldn't display the snap as Server. Why? How to solve? Help, plz... I spent all one day..

#

I called a multicast function and just server executed it, as well as that when Client 1 picked up the weapon, Client 2 couldn't display the snap as Server. Why? How to solve? Help, plz... I spent all one day..

grand kestrel
#

The FindOrCreateRep is a hint but I don't know how to interpret that at all, I'd rather just know how to actually track it down instead of having to throw stuff at a wall and see what sticks

upbeat basin
vagrant grail
upbeat basin
#

Inside your component, just make the SetupTimer event multicast, for your case

vagrant grail
grave lynx
#

Hello, inside a actor, I'm trying to enable inputs. The server can press the key but the client can't. even with a box, casting to the character and getting the player controller from it. I have 'No owning connection for actor' error

EDIT: I think I have to call afunction from the PC with a ref to this actor

upbeat basin
vagrant grail
upbeat basin
#

Well you probably either need to setup the timer for the clients upon connection (PostLogin in GameMode can help) by sending them the current int Timer variable so they can continue from where the server left, or for me the simpler way is making the int Timer variable replicated and setting the the timer event only on the server

vagrant grail
surreal niche
#

I wanted to ask, is there a good reason to have your gameplay tick in the server and client locked to a particular time, say 16ms or 7ms?

upbeat basin
vagrant grail
upbeat basin
#

If you want broadcast hourly event then you can create OnRep function to check if modulo equals to 0 there

vagrant grail
oak oracle
#

hey devs , where i can save my data between maps ? So i got GM where players earns points , and after game ends it should send all players to the Main Menu where thay can see all earned points , where i can save it ?and what class or data i can use to identify user ? tried with GameInstance but didn;t worked

upbeat basin
oak oracle
atomic nest
#

Hello everyone!
I would like to ask a question about UserWidget and RPC (I am making an online game):
I made a PickUp ball, when I touch it, a button will be generated, and when the button is pressed, an event will be executed. However, for the client, this operation must use UFUNCTION (Client, Reliable). At this time, my client player can activate this button through the ball, but the event executed by my OnClicked cannot be informed by RPC to other players ( It's like I'm entertaining myself).I later added the UFUNCTION for Server and NetMulticast, but it didn't work.
I feel like the problem is related to the UserWidget, since I know the Actor has the bReplicates boolean, but the network replication of the UserWidget and the events its buttons control is getting me stuck.
Can someone help me? Thank you so much!🫑

twilit radish
#

πŸ™‚

atomic nest
# twilit radish

Thank you for your answer, it seems that I have to find another way out, otherwise I will get deeper and deeper.🫑

hollow swallow
#

How can i rename a session?

#

or define one before its created

twilit radish
#

Updates the localized settings/properties for the session in question

This post shall give you a short introduction to handling your Multiplayer Sessions via your own C++ code. Most of you probably either started with...

hollow swallow
#

can it be done through blueprints?

twilit radish
#

I don't see a blueprint node for it anywhere. There are for create, delete etc. but I don't see the same for update.

hollow swallow
#

Cheers, ive started digging into advanced sessions now

hushed heart
solar stirrup
#

Hey hey, quick question, wasn't there some new features in 5.0/5.1 or planned features that allow conditional component replication?

#

i.e. only replicate a component to X player

#

I feel like i heard something about it recently but I don't remember

#
Epic Developer Community Forums

Using the Replicated SubObjects List This article was written by Alex K Currently, replicating components and subobjects relies on the virtual function AActor::ReplicateSubobjects. For actors with replicated subobjects, this function must be overridden, with actors needing to manually call ReplicateSubobject and ReplicateSubobjects on each of t...

#

Found it nevermind ^^

dusky yoke
#

Hey guys, when moving to a new level my different player classes are set to the server's player class. I set the class in the main menu, set it in the gameinstance, and then I call the gameinstance in the player controller when spawning in:
Is there anything else I need to do in order for the clients to get the correct class when joining a session?

surreal niche
twilit radish
# dusky yoke Hey guys, when moving to a new level my different player classes are set to the ...

In general the server spawns the pawns / characters players posses. So I'm not quite sure why the clients would need access to that specific class? Normally the flow for spawning a player selected class looks something like:

  • Player joins the server.
  • Sends over what class they selected to the server.
  • The server validates any necessary stuff and spawns in the player pawn and grabs the controller to posses the just spawned pawn.

From there on the pawn should replicate towards the client at some point and that should be it πŸ™‚

twilit radish
surreal niche
#

I'm referencing a youtube video here https://www.youtube.com/watch?v=W3aieHjyNvw

GDC

In this 2017 GDC session, Blizzard's Timothy Ford explains how Overwatch uses the Entity Component System (ECS) architecture to create a rich variety of layered gameplay.

Register for GDC: https://ubm.io/2yWXW38

Join the GDC mailing list: http://www.gdconf.com/subscribe

Follow GDC on Twitter: https://twitter.com/Official_GDC

GDC talks cover...

β–Ά Play video
#

It could be that I just misinterpreted it

twilit radish
#

In what part of the video is this being discussed?

surreal niche
#

t=1479

#

24:39

#

Diagram at 25:30

twilit radish
#

I'm not quite sure what they are referring to honestly.

#

Seems to be somewhat related to their player movement code? But not sure πŸ˜…

surreal niche
#

It seems to me that they are simulating at a fixed rate

#

And interpolating between those simulation frames

green fjord
#

guys what happen if i call rpc (run on server) unreliable on Event Tick if client has 120hz tick speed and server only has 60hz

twin juniper
#

Hi, this may sound silly - I'm new here. But is it possible to have a single server world in UE that can handle more than a thousand players? Without splitting into clusters? Of course if we have an extremely expensive and powerful server. How is it possible that WoW can handle 3000+ players, but I haven't seen it in UE yet?

latent heart
#

Probably not.

#

The client won't own the actor.

frank birch
#

Can I change UGameMapsSettings::TransitionMap during runtime? πŸ€”
should I? πŸ€” πŸ€” πŸ€”

solar stirrup
#

Don't see any reason you couldn't

radiant jolt
#

If I wanted a dedicated server to quit after all players have left, where would I put this logic?

solar stirrup
#

Gamemode's logout function

rich locust
#

So I have an actor that needs spawning, and I have spawned it on Serverside, and this actor also is set to replicate. However it does not appear on the client side. Am I doing something wrong ?

clever hound
#
UFUNCTION(Server, Reliable, WithValidation)
        void Server_MoveForward(float AxisValue);```
```cpp
bool APlayerPawn::Server_MoveForward_Validate(float AxisValue)
{
    return true;
}


//Movement 
void APlayerPawn::Server_MoveForward_Implementation(float AxisValue)
{
    //MovementDirection.X = FMath::Clamp(AxisValue, -1.0f, 1.0f);

    if (Controller != nullptr && AxisValue != 0.f)
    {
        const FRotator Rotation(0.f, HeadCamera->GetComponentRotation().Yaw, 0.f);

        const FVector NewLocation = GetActorLocation() + FRotationMatrix(Rotation).GetUnitAxis(EAxis::X) * AxisValue * MovementSpeed;
        SetActorLocation(NewLocation);

        UE_LOG(LogTemp, Warning, TEXT("%f"), AxisValue);
    }
}```
All I did was this and it replicates the PlayerPawn movement to the server and the other clients. Why???? I thought I would have to check the location in GameStateBase class and send that to the clients or smth but do I not have to do it now or what? The client who is moving cant see itself moving tho so that is a problem
clever hound
#

Do I update the clients locations from GameState to all of the clients? How do I do that I can't come up with anything to write into the Tick() of the GameState? Or do I make it in the gamastate at all

verbal tendon
clever hound
verbal tendon
frank birch
#

look at this bp of a Player State
so, Increase Counter is just a variable++;, nothing to worry about.
The idea is that the user calls the RPC, that increases the variable locally (predicted kinda thingy) and then calls the SERVER procedure that actually increases the variable. When the server ticks and updates, we had the already increased value and we are happy...
HOWEVER, this would increase twice the value on Standalone and on Listen-Servers. Any tricks here? πŸ€”

clever hound
# verbal tendon I glanced over your paragraph twice, and can't quite figure out your situation. ...

Ok so...
I am trying to get all the clients to see each others movements.
Clients = Pawn classes
With only updating the movements from 1 client to the server (code above) it replicates it also to the other clients which is strange and I dont know why it even works when I thought I would have to update the player locations from server to the other clients separately.
Current problem is that the player who is moving can't see its own movement or any location change. So do I still want to update the location from server to all of the clients in GameState? Or what do I use?

verbal tendon
#

And yes that was already a lot clearer and allows other to assist you. Thank you.

rose torrent
#

is it efficient to replicate TArrays?

radiant jolt
#

What exactly should be included in a dedicated server build? For example it doesn't make sense to me that it should have login functions, widgets, etc

clever hound
#

They are pawns who have been posessed normally

bReplicates = true;
bAlwaysRelevant = true;
AutoPossessPlayer = EAutoReceiveInput::Player0;
frank birch
edgy patio
winged badger
winged badger
frank birch
#

RPC is not ran on server, SERVER is
The idea is to have some sort of prediction. So RPC increases locally (in good faith) and then calls SERVER who will correct you because it has the authority anyway

latent heart
#

Server is an RPC

frank birch
#

if I call only the SERVER function, I wouldn't see the value increase until after the network roundtrip

latent heart
#

Your logic is wrong, though

frank birch
#

please help me 😰

latent heart
#

If you already have authority, you don't need to run a server rpc. You're already on the srever.

#

Server doesn't mean "this runs on only on the server" it means "Send this function over the network to the server and run it there" (or run it locally if you're already on the server)

frank birch
latent heart
#

I would not do that.

#

I would do this:
I want to change thing:

  • Am I the server? ** Change thing
  • Am I remote? Ask server to change thing. Server validates that it's an acceptable change. Server changes thing (see **). Value is replicated back to the client (this is a setting on your variable, not a thing that you "do")
frank birch
#

I understand, but on the Am I remote? path, I press a button and I have to wait for the roundtrip for the light to turn on (or whatever)
This isn't a delicated/cheat prone function, so I am safe to assume the user will be able to perform the change and I want to do it immediately

latent heart
#

That is where client prediction comes in.

#

What you can do is assume that the server will say "yes, that's fine" and just change the variable.

#

But if the server doesn't change the variable for some reason, it has to tell the client that the change was unsuccessful. And the client still can't do anything with that change that the server may also have to rollback and fix.

#

Unless it's something very simple like turn a light on or off.

#

What you could do is make the light play a flickering animation until the server confirms it. That would work seamlessly.

#

The better and safer you try to make the user experience, the more complicated the code becomes.

winged badger
#

Problem with your prediction method

#

Client predictively changes value and sends a server rpc

gray holly
#

hey, umm

winged badger
#

Server does its thing and says no

gray holly
#

is there SUPPOSED to be desync happening in the default thirdperson multiplayer game?

winged badger
#

As nothing changed on server, it wont correct client

#

Client now locked in invslid state

latent heart
#

That's why you send the rpc back saying it was unsuccessful and the c linet changes it back.

#

It's not perfect. But it never can be.

winged badger
frank birch
winged badger
#

Youll find people use it for literally hundreds of things

clear island
latent heart
#

Variables aren't replicated if they don't change.

#

If the client changes them, the srever won't correct it until it sends new values.

winged badger
#

Your question is equivalent to "hey guys how can i fix a bug?"

clear island
#

yea thats normal

#

physics cant be replicated

gray holly
#

Is there a way I can mark physics to be rep

#

really?

clear island
#

yep

gray holly
#

wow.

winged badger
#

And no

#

Physix is not deterministic

#

Same scenario, same machine, run it 20 times get 20 different results

clear island
#

I dont think theres any game engine out there with deterministic physics

#

so yea its pretty much expected

latent heart
#

People try to do it.

clear island
#

yea theres ways to fake it

latent heart
#

They just keep trying, bless their cotton socks.

winged badger
#

Some made it work, with 8 physics objects total and cystom physics engine

#

Rocket League

clear island
#

yea I saw their talk

frank birch
gray holly
#

I mean dark and darker has synced ragdolling

clear island
#

many games have "synced" ragdolls

#

gta5 too

#

its not really 100% fully synced

latent heart
clear island
#

but very close

#

such that it wont matter

winged badger
#

Its more of a ragdoll that stays in sync most of the time

frank birch
clear island
#

basically I think the idea is to simulate physics locally for a certain period, then at some point force a synced pose animation

#

the tricky part is knowing when to do it

#

but find the right time to force a synced animation pose + interping to location/rotation and that will be good enough

gray holly
#

It makes sense now that I think about it if what I have in my head is accurate, that unless you use lockstep synchronization (don't update anything until everyone has the data causing a delay on everyones machine before the gamestate changes) then an object with physics being interacted with locally is going to be out of sync and all things that physics object interacts with will be out of sync as well until at the very least the data is sent to re-sync them in which case it will look like a teleportation for any fast moving objects

#

is that correct?

#

so how exactly does rocket league do it? Because I have a lot of hours on that game and ocassionally it will do something called a "ghost hit"

#

where someone hits the ball and you see the ball start to change momentum and then suddenly correct itself and snap back to its previous location as though it wasn't touched

#

usually when this happens all or most players see the "ghost hit"

#

the more I think about it the more I think it could be made to be deterministic unless 2 players are interacting with an object at the same time

twilit radish
#

@gray holly Rocket League swapped out their physics engine with a fixed timestamp one that’s also deterministic. They basically predict whatever they can at that point as it will β€œjust” work but still rollback positions if they get out of sync because of players bumping into each other as an example to keep authority.

prisma snow
honest rain
#

Hello there !
I have an actor in my scene, with a custom event set to 'multicast' so it executes both on server and client, which runs fine.
When I take this actor and instead of having the parent class 'actor', I put it as 'Chunk', which is a c++ derivated from class actor.
But when changing this parent class, the multi cast event won't fire on the client, only on the server, does anybody have an idea why ?

#

this is my class declaration : class MULTIPLAYERSERVER_API AChunk : public AActor

#

and I do set the replication in the declaration : Mesh->SetIsReplicated(true);

#

the actor is visible both on server and client though

real ridge
#

it is better to use game mode and game state for mp than game mode base and game state base?

#

i just realized i have both base in my mp game

#

but its in c++

honest rain
#

I am not using the game mode at all to do this

real ridge
honest rain
#

I mean I have a game mode, but not transiting through it to get my multicast going πŸ˜†

clever hound
wheat niche
#

Hey, i have a problem im trying to run a custom event from a client it tries to call SetMaterialServer it replicated (run server only) und and multicast if i press k on the server it works but for the client it wont do anythink can someone help me

verbal tendon
#

I have no personal experience with that as I usually work with Characters for player controlled actors, but it should work

prisma snow
#

Replication design question: I'm brainstorming about how to replicate our units' combat for large unit counts. We do use GAS, but if we keep it will have to be modified so I'm trying to think a concept first:

Targeting will be server-only and replicated to clients. But once units are in range and start attacking, I am thinking several alternatives:

Attacks are very simple (shoot/wait until recharged, and repeat). So I could send an RPC each time an attack is launched, or maybe some boolean flag ("isInCombat") that serves as start/end point to the attack loop, which would be less bandwidth intensive, but harder to control in the future (for example, imagine that the unit activates a attack increase ability).

On the other hand, health is also calculated on the server and replicated to clients. I could add the new health together with the attack payload, but then I'd be RPCing state changes, where probably a replicated array serializer with health values would work best.

Another option would be to RPC the new health values, but only kill units after server sends a special death event.

Reducing bandwidth and CPU usage for replication is a concern given the scale of the game, all of the above would be sent in batches through RPCs or Array Serializers

latent heart
#

No. You need a real actor. You have a choice of 3. Player state, controller and pawn/character.

#

You don't need to do that at all.

#

...and so what if you do have 15 ufunctions?

#

That's still a small pawn.

#

I'm not seeing how that is relevant.

#

Not possible.

#

I have no idea why your AInfo actor isn't just a pawn.

modest crater
#

TIL if a client predicts an action an locally changes an OnRep value to the same as the servers then the OnRep wont run when its received loool sadcat

#

Spent like 2 hours wondering what I was doing wrong

hidden lion
#

rep notify always sweeney_activate

latent heart
#

Well that's inconvenient.

abstract pike
#

I'm deferred spawning an actor and it's being routed through replication graph but it's ActorLocation is (0, 0, 0) despite having a valid transform set on the deferred spawn call. Any idea how I can get it to have the actor location I set at that time or do I just have to resign myself to updating it afterwards?

latent heart
#

Are you calling finish spawn?

abstract pike
#

Yes but it hits RouteAddNetworkActorToNodes immediately from the deferredSpawn call far before the FinishSpawn

#

And unfortunately it seems to be before the actor has it's location actually set by the transform passed in

latent heart
#

It's weird that that happens without multithreading.

#

is it appearing on the client in the wrong position?

abstract pike
#

Well I have replication decided by location at the moment

#

And so all of them are failing the location check and not replicating at all

latent heart
#

Ah.

abstract pike
#

I just tried out updating the replication status afterwards and that seems to work sort of

latent heart
#

Well it's the root component, not the actor, which decides the actor's location. Maybe it's adding the actor before the root component is properly initialised?!

abstract pike
#

But I think I'm missing some of the functionality because it's not replicating on the initial spawn

abstract pike
#

In which case I'm kinda screwed

latent heart
#

You could turn off replication until after it's finished spawned.

abstract pike
latent heart
#

Honestly, I'm not sure if you can even toggle rep on and off for a whole actor.

#

An actor has a setting that sets whether it's replicated at all, right?

abstract pike
#

Oh

latent heart
#

Turn it on after you've finished setting up your actor.

abstract pike
#

It's overriden by rep graph somewhat

latent heart
#

Ah. Well that was a kind of wild stab in the dark anyway. 😦

abstract pike
#

I guess I could just assume they're all valid if they're at 0,0 and then update properly once I get the actual location..

#

😬

latent heart
#

You're gonna end up with a ton of actors spawning at 0,0,0 and snapping somewhere else πŸ˜›

abstract pike
#

Gross eh

#

What an annoying thing to discover..

latent heart
#

The other alternative is to somehow do it without deferred spawning.

#

Does regular spawning actually work?

#

With the locations

abstract pike
#

We have values we set during the deferred spawn we need replicated in the first spawn

#

But maybe I could try a broken spawn with regular spawn just to check that

latent heart
#

You could hack that the same way hte object initialiser does it πŸ˜„

abstract pike
latent heart
#

Yeah.

#

You can statically reference the OI from a constructor without using the OI constructor. So it must statically store the currently being constructed object on a stack or some such.

abstract pike
latent heart
#

Haha.

#

Yeah. static FMyDeferredSpawningData πŸ˜„

abstract pike
#

Must be something to do with the initialization that happens when actually running the construction scripts which doesn't happen till FinishSpawn otherwise

latent heart
#

Yeah.

#

There's an actor lifecycle graph thing that says that somewhere.

abstract pike
#

@latent heart I got it πŸ˜„

#

Turns out, to set the root component location in DeferredSpawn it needs to have a cpp root component

#

This particular actor was just set up in blueprint

#

By adding a USceneComponent in cpp as the RootComponent in the constructor it works with DeferredSpawn

#

😁

latent heart
#

Ah ha.

#

Bypassing the need for the BPCS!

abstract pike
#

I still have the issue that Multicasts called right after spawn don't replicate to the client like they used to before rep graph though ☹️

latent heart
#

What are you doing with your multicast?

#

You fake could it with PostNetInit

#

Or, rather, is PostNetInit be what you should be using? πŸ™‚

abstract pike
#

The actor in this case is for an ability's effect which is multicasting to show VFX

#

I could probably just play the VFX based on begin play or something like that

#

It's just annoying to go and recode them all given it was working on the old replication reliably

latent heart
#

Is the entire point of the actor to show the vfx?

abstract pike
#

No it does the gameplay effects as well on the server

#

The multicast is just how it kicks off the visuals

latent heart
#

Well, even so. It sounds like you want a non replicated server actor and a multicast to your clients to spawn their own vfx πŸ˜›

abstract pike
#

Well yea, because the multicast would reliably work immediately after being spawned that ended up being how they all got made XD

latent heart
#

Compartmentalisation!

abstract pike
#

Well it's tidy having an object that represents the whole gameplay effect

#

It just... doesn't work trying to use it so quickly after spawning XD

latent heart
#

Maybe maybe.

abstract pike
#

Long term it will ofc be changed

#

It's more how to make things work again now without all the rework up front

#

Plus the wondering why the heck it was so reliable under the normal replication driver

latent heart
#

Because reasons ℒ️

#

Almost as good as raisins.

#

Anyway, it's 2am and I've started to ramble. Time to sleep. Night!

abstract pike
#

Good night

latent heart
#

Np

honest rain
#

When you spawn actors using a multicast function, is it normal that the actor detected on the server and the client ( after a line trace for example ) has a different name ?

deep coral
#

is it possible to change the Game mode or Game State of a level when loading a level? (ie, I want to open this multiplayer level with Game mode as Team deathmatch GM, instead of deathmatch GM)?

fossil spoke
misty stirrup
#

if two servers are on the same level, is it possible to pass a player between the servers?

fossil spoke
#

You can tell that Player to join another Server, sure.

misty stirrup
#

like if the player was in a grey box map, there are two dedicated servers, and i called APlayerController::ClientTravel could I just send the player back and forth between servers?

#

same level, same actors in theory

fossil spoke
#

The levels and actors in a Server have no bearing on a Players ability to join that Server.

misty stirrup
#

yes but there is seamless and nonseamless travel

#

i want seamless and im confused on what can cause it to become unseamless

fossil spoke
#

Seamless Travel is a travel operation for Clients that are connected to a Server to a new map whilst remaining on that Server.

misty stirrup
#

ohh

fossil spoke
#

There is no Seamless Travel between Servers, that would be considered a Non-seamless Travel.

#

Also known as a Hard Travel

misty stirrup
#

just seems like it would be super useful lol

fossil spoke
#

Its just not how Unreal is architected out of the box.

grand kestrel
#

Did you guys notice that servers and clients don't have an accurate deltatime in CMC's PerformMovement() and therefore physics loops also? TickComponent works as expected, though