#multiplayer

1 messages ยท Page 629 of 1

night tartan
#

except my own prints

#

OnRep is firing, and I have a print of the PlayerArray and it's saying 0

severe widget
#

no errors then, either?

night tartan
#

nope

#

and the issue isn't that UMG can't access GameState properly?

#

this should work?\

#

GameState is indeed replicated Server to Client and exists on both?

bitter oriole
#

GameState exists everywhere, is replicated

night tartan
#

okay that's what I read and that's why I'm trying to have my Lobby widget just update the PlayerCount off the PlayerArray

#

would there be a reason the GameState is not populating the PlayerArray?

#

okay so Server is reporting PlayerArray growing

#

however, Clients are still seeing 0

#

what would be the proper function call in a UMG update to get the GameState and the PlayerArray properly? Maybe I'm doing something wrong in the UMG to get the data?

#

GetWorld()->GetGameState<AMyGameStateExample>()->PlayerArray.Num() ?

peak star
#

I think I found a way to stop players from joining when a match is already running. In the documentation it says the GameMode has an event called PreLogin and if I implement it to set an Error message then it will reject the player who is attempting to join the server:

PreLogin

Accepts or rejects a player who is attempting to join the server. Causes the Login function to fail if it sets ErrorMessage to a non-empty string. PreLogin is called before Login, and a significant amount of time may pass before Login is called, especially if the joining player needs to download game content.

#

Is that a good way to do it? I want to make it so players can only join a server when the server is in a "Lobby" level.

bitter oriole
night tartan
#

The ones already logged on get updated again, and they still see 0.

bitter oriole
#

How long after connection are you testing this ?

night tartan
#

Full many seconds.

#

I connect a client. I wait. I connect another. Still 0.

#

The already connected clients should easily have a GameState to access. And the PlayerArray is still 0, no matter how many other clients I log in.

#

Server confirms it's growing. Client's UMG, using the above function call chain, still only gets a 0.

meager spade
#

he did not ask that

#

he asked when does the widget get created

#

if its too early, the player array will be empty

#

put a delay or timer before accessing the gamestate

night tartan
#

It is on a Rep Notify to get updated.

meager spade
#

what rep notify?

night tartan
#

Even later, after it's already made, the update isn't working.

#

I'm saying an already connected client, with a widget, who is calling an update to get the PlayerArray is still also seeing 0.

meager spade
#

so your grabbing it on tick?

#

that array should never be null

bitter oriole
#

To be clear, put this count check on tick on the client and check the array size. If after 5s it hasn't replicated - either network is completely saturated, or you have disabled replication on the player state (doubt it'd work), or something else is horribly wrong

night tartan
#

I'll check that.

bitter oriole
#

(Or you aren't connected at all)

night tartan
#

They're definitely connected.

meager spade
#

even standalone has one player in that array

night tartan
#

That's what I figured.

meager spade
#

that array only get populated when the playerstate replicates

night tartan
#

I'm just confused why an already connected client is incapable of updating. I'd understand if it was behind and was too fast.

#

I've encountered that before.

#

Ugh. Another player state issue then?

dull lance
#

are you oversaturating your buffers?

night tartan
#

No

dull lance
#

how do you know you're not

bitter oriole
#

Is this widget in the world ?

night tartan
#

I am really confused at the proper way to use a PlayerState.

#

The general advice I'm getting is to store data on GameState and PlayerState. But when?

bitter oriole
#

Any time

#

it'll replicate

night tartan
#

It seems like they are just not there yet when the data needs to get passed.

#

So does everyone put timers in their code?

bitter oriole
#

You can never assume anything about when objects exist on the client

#

Timers don't cut it

#

Simply assume objects may not exist yet

night tartan
#

I'm really confused how to properly update a UI then.

#

I just want the UI to get that info.

bitter oriole
#

"if game state not there, then don't show the UI and stay in loading screen"

night tartan
#

Is GameState the one big class I should wait for?

bitter oriole
#

No

#

Every single replicated actor

night tartan
#

When is the best time to actually make the widget call?

bitter oriole
#

There isn't going to be one

night tartan
#

Lol

bitter oriole
#

It might take 0.1s or 10s

night tartan
#

I am very confused at best practices then.

bitter oriole
#

It's simple

#

Never assume anything about time

#

Assume your game state will replicate 10s after the map loads

night tartan
#

I put in "infinite until" loops in Blueprints, but that just seems like bad programming?

bitter oriole
#

Can't do that obviously, you would also block replication.

night tartan
#

Right

#

So... I'm confused. Lol

bitter oriole
#

Your UI just need to be comfortable with the data not existing, or the UI needs to stay hidden until the data is there

night tartan
#

Okay

bitter oriole
#

For what it's worth I have my entire game hidden until I have the player pawn, player state, various systems completely available on client with validated data

#

The wait time also allows for textures to load a bit

#

I suggest doing that

night tartan
#

Okay t hanks

rapid bronze
#

Hello, I have a question about when to use the Server arguement on UFUNCTION
Don't know if this belongs here or cpp tho :p

I have a little example in case, pretty new to C++ Networking so any advice is welcome โค๏ธ

void UMetabolism::SetHealth_Implementation(float Amount)
{
    Health = FMath::Clamp(Amount, 0.f, GetHealthMax());
    if (Health == 0.f)
    {
        HandleDeath();
    }
}

void UMetabolism::SetIsAlive_Implementation(bool IsAlive)
{
    bAlive = IsAlive;
}

void UMetabolism::HandleDeath_Implementation()
{
    SetIsAlive(false);
}

In this case all 3 Functions are run on Server, what I'm wondering is if i call HandleDeath from Server, will SetIsAlive be on Server too if it doesn't have _Implementation?
They will probs be used in BP too if needed separately since they are callable
Is there any set rule to follow regarding this?

quasi tide
#

So - maybe I'm misunderstanding something. Inside of the rep notify functions, I am adjusting the speed of the character. When not a client - it is being called twice. I have the variable on the skip owner condition, so why would it be called twice? Shouldn't the owner be skipped?

This is affecting it in offline and listen server mode, and only affecting the server.

The logic (as I understand it) -> Press Aim, call ServerAim, set variable on the server and the characters speed. Then it gets replicated to all other clients, except the owner, then set variable locally, call OnRep function, do rest of local stuff (setting up UI)

Again - if I am playing as a client, it works as expected, but not if I'm playing as the server.

lost dune
#

Is it possible to package the server in Development build (to have the logs output) and the client in Shipping build ?

twilit flint
#

Hi, after execute "open /Game/TPtemplate/ThirdPersonBP/Maps/ThirdPersonExampleMap.umap?listen " character is falling. I can't find solution in net, any help ?

lost dune
#

are you using world composition?

twilit flint
#

@lost dune probably no. I just need simple host/join multiplayer for testing maps and I have bind to UI button execute console command. Ofx when I use play button in viewport I can normaly play as client or listen srver.

waxen quartz
#

Anyone know how to send session custom data or how it works?

#

there's a FOnSessionCustomDataChangedDelegate but I'm not quite sure how it works

#

basically I want to update session data before the map travel begins once the client has joined the session (e.g. tell the server when a client readies up)

twin juniper
#

Any reason why I would be getting this error? I am using Spatial OS.

#

@me if anyone has a solution

lost dune
#

@twilit flint have you got a player start?

faint pawn
#

would it be ok for me to do all my casting inside my PlayerState, and then pass the references to the gamemode?

twilit flint
#

@lost dune yes, default Playerstate

dark edge
twilit flint
#

sorry, Ofx I have also on map player start. And when i press play form viewport I use it and works well

twilit flint
#

I've just saw this problem occurs if I changing different level. If i open ThirdPersonExampleMap.umap when I've already loaded this map then is all fine.

#

Both maps ThirdPersonExampleMap.umap and MainMenu.umap have same world settings ๐Ÿ˜ฆ

peak star
#

Hmm i cant find the PreLogin event in GameMode or GameModeBase blueprint class

vague parrot
#

Hey, sorry if im dragging the chat back

#

are there any good tutorials on implementing multiplayer

twilit flint
#

omg, when I use short level name "ThirdPersonExampleMap" is working, with full path "/Game/ThirdPersonBP/Maps/ThirdPersonExampleMap.umap" character is falling :D:D, @lost dune thx for help

peak star
#

@vague parrot have you tried the Multiplayer Shootout example in the Learn tab of the Epic Launcher?

barren patrol
#

Has anyone implemented a multiplayer RPG inventory system that supports swapping items when you drag and drop an item into a non-empty slot?

#

I've been working on this but re-written my approach once already now. It seems non-trivial to get all the edge cases right when you have to get the WidgetUI view, plus client and server data fields to all be synced correctly.

#

In particular, do you save the "grabbed item" as a replicated field?

#

If you try and keep the "grabbed item" as a variable only on the widget side, you get into a really weird case when you try to swap an item. Since the newly picked up item you swapped the old item with will not have a new spot yet.

peak star
#

Going back to my subject, I created a subclass of GameModeBase and overrode the PreLogin function to set the error message if the UWorld's CurrentLevel's Name does not end with with "_Lobby", but it does not seem to write to the logs where I put UE_LOG so I think it must not be running?

barren patrol
#

So from widget side it is perfectly sane to put the 1st item in the new slot and "grab" the second item. But I have two items in the same slot until I also pick a new slot for the 2nd item, from a replicated array perspective.

#

I made it overly complicated for myself too, by doing a jigsaw inventory. For an inventory with consistent item sizes, I could temporarily swap the items. But for jigsaw, you may have dropped a smaller item and picked up a bigger one. So you can't assume it fits in the first item's slot.

peak star
#

@barren patrol sounds like you may need to prevent drop/swap if the new item won't fit, and if no fit can be found then dont pick it up.

barren patrol
#

yeah, the easy solution is to not allow swaps at all

#

or are you saying I should try and automatically find a new spot for the 2nd item, and disallow swaps only if it wont fit?

#

i tried implementing this with just disallowing swaps, it was ok. felt a little clunky.

peak star
#

Yeah IDK I have never done an inventory before. But I think for when you pick an item up if it is trying to find a spot for it automatically like when you loot in WoW then if client side fails jigsaw test on all positions then it can decide not to ask the server to do it either and then if it succeeds i think the server should run the same fit test on all positions and if it fails then the change wont happen and the replication would correct the client view of the inventory back to before they tried to pick up

barren patrol
#

Ok you are right, I just tested this in Diablo 3. It will automatically find a spot for the 2nd item, and fail with "Not enough inventory space to complete this operation" error if it can't find a spot.

#

I could easily mask the swap on the client side by automatically grabbing the item instead, but if the drag is cancelled then throw it in that default spot. And fail the operation if there is no available spot.

#

Thanks for helping me think through that one ๐Ÿ™‚

dire tusk
#

Hi Peeps
Question about HasAuthority
If I have 3 components that tick on my actor
Do I have to check if I have authority over each?
I assumed by default it would just run on the client whos using that actor?
But then AI actors and their components who I just need to do an override on my actor ticking like
AIActor::Tick()
{
if(!HasAuthority())
return

Super::Tick()

// my logic here

}

Type of approach?

waxen quartz
#

acceleratxr , otherwise playfab imo

quasi tide
#

I'm pulling my hair out over this. I'm trying to have the client run a function on the server to deal damage.

Client does line traces and calls an RPC with Run on Server replication. This then calls a multi-cast RPC that deals the damage. I have debugged the game and have seen that the Run on Server RPC IS being executed from the client side (IE - in BP, the execution wire is highlighting). However, that is where it is stopping and I can't figure out why. So, the function doesn't actually get ran on the server.

#

When the client hits the character - nothing happens. Even though the execution path (up to the Was Hit RPC) is highlighted

#

(Sidenote - I know the names suck, I was just getting some stuff working. Don't care about interfaces and all that right now either)

lost inlet
#

are you in "play as client" mode in the editor? the first player on a listen server is the server

quasi tide
#

Debugging mode. Listen server and I am playing as the client, not as the server.

lost inlet
#

well there you go

#

listen server, YOU ARE THE SERVER if you're the first player

quasi tide
#

I wasn't

#

I am playing as the client specifically

lost inlet
#

these are 2 different options so please be specific

quasi tide
#

When you select to play as listen server and play as 2 people, it spawns a server window and a client window

lost inlet
#

there's standalone, listen server, and "play as client" (dedicated server mode)

quasi tide
#

I am playing in the client window

lost inlet
#

so in the BP debugger, you selected the client's world?

quasi tide
#

Yes

#

There is a dropdown that shows:

BP_Hero (Server)
BP_Hero1 (Server) <--- this is actually the client, but on the server
BP_Hero (Client) <---- this is the client, but on the client (so what you play as)
BP_Hero1 (Client)

lost inlet
#

I would strongly recommend play as client over listen server mode for narrowing this down

quasi tide
#

The same issue exists. For w/e reason, I can't have the client tell the server to run the function.

lost inlet
#

because the client doesn't own the actor?

quasi tide
#

Client doesn't own the Hero character? Doesn't that get set automatically upon spawning via the network spawn actor?

lost inlet
#

well if the owner is something that the can be related back to a player (pawn, controller, etc)

#

then you should be able to use server RPCs

#

the output log will tell you if there's an ownership problem

quasi tide
#

Oh my jeebus. The Enemy has no owner. What in sam hell

#

What could cause the server to not claim ownership of the AI when spawned?

#

IE - it is pre-placed in the world

lost inlet
#

well you need to SetOwner it (or set the owner at construction time)

quasi tide
#

It's the latter part that is a loss on me. Shouldn't the server automatically assign ownership to itself?

lost inlet
#

Huh? You were asking about a client calling a server RPC

quasi tide
#

Yes

#

The problem ended up being shown in the output log

lost inlet
#

The client calling it would need net ownership in order for that to work at all

quasi tide
#

Hot diggity dog. I worked it out. Thanks dude. Crash course on ownership. I get it now. Actor needs to know the owner so it can route the RPC and networking stuff properly.

#

I was screwing up because I was trying to call the method on the enemy itself. What I ended up doing was, if it was a hit - call a server RPC on the player that then calls the damage function on the server.

#

I was reading the (if owning client) incorrectly. Early AM coding. Need to go to bed.

thin stratus
#

Yeah, you can't call the RPC on the Enemy :P

#

At least not by default I guess

#

Also not sure if Pawns/Characters even allow RPCs on BeginPlay, even if you pass in the Owner.
Think they need to be possessed first. But that I'm not sure of. Epic sometimes does some weird things that don't follow their usual rules

quasi parrot
#

Hi, i was wondering. EOS provide a join friend or make it a group. But it's not the same way as session. Why do we need to forcefully join the map. And not getting just the infos of the session itself ?

woeful lantern
#

hello, how i can get the player index from the pawn class ?

kindred widget
#

@woeful lantern Very few things require the player index in multiplayer. What are you trying to do?

woeful lantern
woeful lantern
kindred widget
#

Generally you won't use that for anything server side. On a client, only PlayerController0 ever exists. Which makes it okay to use GetPlayerControler0 for UI stuff on a client or a Listenserver. You should never be using that call in server code though. Even on a listenserver, in server code, you rely on abstract references. Do you want to do something to all player's player controllers? GetGameState->GetPlayersArray->GetPawnPrivate->GetController->CastToPlayerControllerClass

#

If you want to do something to a specific player controller, the code should be done in a way that it doesn't rely on numbers, but on the logic flow.

woeful lantern
#

i also need it for this:

kindred widget
#

That probably shouldn't be replicated. Clients should just set that themselves, probably based on the Pawn they've possessed if you have different pitch min/maxes. Server can't really enforce that. Players can hack around it since it exists on their client.

woeful lantern
#

to set it, i need "get player camera manager", but i need a player index for it

#

there is no way to get it ?

#

from the controller

#

or the pawn

kindred widget
#

Why would you make the server set this for clients though?

woeful lantern
#

any other options ?

#

how i can set it from the client ?

kindred widget
#

Would be much easier in C++ by overriding an onrep. I wonder if ViewTarget stuff would work for that. Haven't tested those functions myself. Not certain if those fire on possession. But the point would be to just find an event that runs when that client possesses a pawn, and then get the local view manager to set it's max/min values.

#

What you're doing won't really work anyhow unless you're using local coop.

#

CameraManager only exists once per local controller if I recall correctly. So putting anything but zero should only work on local coop. Listenservers even only have one camera manager, I don't believe it's replicated.

#

So, making the server try to handle it won't work without sending RPCs back through the client's controller to make them affect their own camera manager, since server has no authority over their camera manager. But the usage shouldn't really require networking. Some form of pitch min/max based on the view target should be fine.

meager spade
#

@woeful lantern make a custom Player Camera Managaer BP

#

set those values, and tell your player controller to use

#

also you can access PlayerCamera manager via controller

#

those statics are bad news for multiplayer.

quasi tide
# thin stratus Yeah, you can't call the RPC on the Enemy :P

Yeah - it just wasn't registering in my brain what was actually happening. But I've learned so much be doing this little mini-project. Glad it is in BP for the time being - helps visualize the flow. I can already see how I can take this stuff to my C++ game and apply it. Thanks for your compendium btw. I only have one other issue that I haven't been able to solve thus far related to networking. Just doing a work around about it for the time being.

Eventually I'll move into map travel and player state and all that jazz. But not yet.

distant wave
#

Hey guys! Sorry for bumping but I have this very strange issue.
Networking isn't working anymore in my project. If I play in editor (listen server, 2 players), the client take a lot of time to load and after it finally does, there is a very big lag.
This started happening after I've updated my project from 4.20 to 4.25.
Everything was fine in 4.20, the networking was working smoothly and now it broke for this specific project (I tried to make an empty project and some rpcs for testing and they were working).
I have no idea what is going on.
So right now I am running 4.25.4. I will give you a brief description of the things I've done after the update. I fixed the includes and switched every single "Role" with "GetLocalRole()". I have deleted .vs, Binaries, Intermediate, Saved and the *.SLN file and regenerated them. That's about it.

Here is a video of the issue (4.25.4): https://youtu.be/0DOKUKvdpIU

Here is a video from a year ago when I was running 4.20.2 or .3: https://youtu.be/r6KEINFC9bM (everything was fine)

In the first video I don't have a shotgun in my hands, but I have tried adding a weapon and the problem persist (as expected). If any of you have any idea what is going on, please tell me.

This started happening after I've updated my project from 4.20 to 4.25.

Everything was fine in 4.20, the networking was working smoothly and now it broke for this specific project (I tried to make an empty project and some rpcs for testing and they were working). I have no idea what is going on.

โ–ถ Play video
bitter swift
#

How do I set the speed for all the clients and not just the server, for this projectile I'm spawning with a variable for initial speed? (dedicated server)

meager spade
#

construction script is not called when an actor is spawned iirc

#

oh

#

thats pre-placed nvm

#

but you want to set the speed at beginplay

bitter swift
meager spade
#

and you need to replicate that Speed variable

#

else clients will have default speed

bitter swift
#

ah good. I almost said something very wrong. The construction script does actually run on all clients. So you're right. I need to replicate the variable

#

replicating the vars didn't work :S
I tried on both despite what the screenshots say

#

i know a way, where you spawn the projectiles on multicast instead and have the actor NOT replicated. But something tells me, it's better to just create the actor on the server and have it be replicated

#

How do I set the initial speed to be set on the clients too?

quasi parrot
#

re : i'm talking this effetc

shy kelp
#

If a listen server is hosting a game and I want to allow them to change game settings before switching to the main game, i would use the game instance right? Slightly confused as I thought the game instance wasnt replicated

lost inlet
shy kelp
#

does it not?

lost inlet
#

game instances do not replicate

#

and I'm wondering why replication is important

shy kelp
#

oh

#

idk

#

yeah now that i think about

#

hmm, so i can use the game instance right?

lost dune
#

How to destroy the session to server?

#

the node destroy session dosent work

#

it fails

#

i put in get player controller

peak star
#

Good news: I got my C++ override of PreLogin to reject connections if the server is not in a level whose name ends in "_Lobby". The trick was that I had to NOT call Super or it would approve the login anyway regardless of there being an ErrorMessage set, and furthermore Super would override the ErrorMessage. So i had to override without Super.

hollow eagle
#

The better way to do it is to just call Super::PreLogin after you do your checks (and don't call it if you fail the login)

bitter oriole
#

Alright moving this here

#

My point from #cpp - you only need the UE4 Steam net driver if you are using Steam for matchmaking

#

Apparently it's not even needed

lost inlet
#

it's only needed if you use the p2p connections

bitter oriole
#

We're talking the regular Steam driver, not the Steam socket net driver, right ?

#

Lorash was saying - "just that even if you ship drm-free you can't use this without the client" but I fail to see how your DRM-free Steam game that uses the UE4 Steam net driver, could also work without the Steam client

#

The net driver is actually user-changeable AFAIK

#

But if you have that net driver you're also using Steam itself, so how's that for lock-in @twin juniper ?

lost inlet
#

you wouldn't, you'd use something like the null OSS for that

#

unless you have some code to hotswap it depending on if it's launched by steam or not

bitter oriole
#

But it's not a lock-in, though - users can actually fall back to NULL

#

That's not really the reason though because it takes explicit effort in UE4 to make your game Steam only

lost inlet
#

it does happen though, when people use those steam plugins from the marketplace (ughh)

#

that's why the OSS abstraction exists

bitter oriole
#

But there is nothing to implement

#

The switching is built-in

#

I know my game has Steam as OSS but I don't have Steam open while working and so I work with NULL

#

I didn't write that

#

It's literally an engine feature

#

The only way to force Steam is to actually write Steam specific code and that's not negligence, that's explicit lockin

#

In any case the Steam net driver is entirely unrelated to this

#

It's user-switchable and not even mandatory for Steam apparently

#

Well you were talking about how Steam sockets would create an accidental lock-in, but that isn't true, the sockets in UE4 are always user-switchable

#

You're not getting my point here

#

I'm not saying games don't have Steam lockin

#

I'm saying UE4 games don't have Steam sockets forcing you to use Steam

#

The rest of the game might assume Steam

#

The sockets are user-switchable

#

And, AFAIK, the net driver will downgrade to default in UE4 without Steam (the OSS certainly does)

#

Alright so I'll leave it to this : Steam sockets in UE4 can never cause a game to accidentally lock users into the Steam client

#

UE4 games might certainly get your Steam avatar at launch and then crash because it's actually the NULL OSS running, sure

twin juniper
#

if I were to want to be able to let players download the dedicated server and have there server displayed on the server list this is where I am getting lost, anyone have any info for this?

bitter oriole
#

You'd put the dedicated server up on Steam as an alternate download or put it up on your website ; and the setup for players would be similar to the setup for regular hosting

#

Should be pretty straightforward

twin juniper
#

Not saying how they can download it

#

I am saying how to make the dedicated server broadcast to a server list

bitter oriole
#

Well, that depends on your online service

#

If you use Steam, that's handled for you

#

I suspect EOS and GOG have similar features

#

If you use Steam, that's handled for you

#

I suspect EOS and GOG have similar features

lost inlet
#

steam makes it easy, you will have to ask them to add the dedicated server app ID to the complementary package so anyone can download it

twin juniper
#

I would like to go down the route of steam but every tut I have seen, it seems like no one can figure out how to get the server name changed from a bunch of digits

lost inlet
#

plus steamcmd works on app IDs

bitter oriole
#

GOG does have an online service with an UE4 OSS

twin juniper
lost inlet
#

well name it?

twin juniper
#

4Head

#

If it were only that simple hahah

#

With dedicated servers its different then when its just a p2p server

kindred widget
#

UE4 doesn't have p2p servers.

bitter oriole
#

(UE4 also has listen server btw if you want to avoid all that)

signal lance
#

how many times in the last week I had to repeat that p2p is not a thing with UE4 is getting highly annoying ๐Ÿ˜

bitter oriole
#

You must be new here

hollow eagle
#

maybe it'll be a thing if you believe hard enough
(or if you write your own networking layer, have fun!)

#

make your game play-by-email - now you don't need netcode at all!

signal lance
lost inlet
bitter oriole
#

To be fair a turn-based game works perfectly fine with listen server, you can even make each client very highly autonomous on top of it and only use the UE4 networking to pass data along

twin juniper
#

breh I was talking about advanced sessions lmao

#

not ue4

kindred widget
#

Advanced sessions is inside of UE4 isn't it?

bitter oriole
#

It's a plugin

signal lance
#

advanced sessions is a ue4 plugin

twin juniper
#

I am aware, maybe p2p isnt the right term

lost inlet
#

it's steamworks API

signal lance
lost inlet
#

but we had to modify the online subsystem to readily expose it

kindred widget
#

P2P implies that clients can talk to each other. In UE4 networking, clients have zero contact with one another. A client can only ever talk to the server.

signal lance
#

^

bitter oriole
#

Yeah, that makes sense. My own game is listen server + very autonomous clients.

twin juniper
#

My bad, I didn't mean to start ww3 in here I was just trying to find a detailed guide on dedicated servers

signal lance
#

no worries ๐Ÿ˜›

empty bluff
#

possibly a noob question, but if i from one client want to update all other clients hud (ie. when i write a chat message), should i go through a Server RPC and from there, access the gamestate's PlayerArray to get all the PlayerState and from there to the Pawn and then finally to the PlayerController or is there a more direct and correct way? See screenshot below:

#

possibly a noob question, but if i from one client want to update all other clients hud (ie. when i write a chat message), should i go through a Server RPC and from there, access the gamestate's PlayerArray to get all the PlayerState and from there to the Pawn and then finally to the PlayerController or is there a more direct and correct way? See screenshot above

twin juniper
#

That was the first thing I tried, then realized I needed a way to display the servers to a server list. Which is then where I was googling the intergration of advanced sessions with a dedicated server which is where there is no good docs on. Everything is from like 2 years ago and apperently dosen't work the same no more

empty bluff
#

@twin juniper dedicated servers dont have a player

lost inlet
#

nothing really other than it doesn't relate to an actual user

#

a lot of the serverside code paths will be the same though

empty bluff
#

as far as i understand, a listenserver is a dedicatedserver + a client (someone correct me if im wrong)

lost inlet
#

unless you do something special like p2p connections, then it's not going to be much different from a clientside perspective

#

though using EOS for p2p might be interesting for the NAT punchthrough

lost inlet
#

they don't have a separate "world" for the server

empty bluff
lost inlet
#

?

#

there isn't a player local to a dedicated server

#

thus the name

empty bluff
# lost inlet ?

i meant that, if i start a game with 1 player = listenserver and do a printout of Has_auth, it will result in two lines: Server: Has Auth and Client1: Remote

twin juniper
#

the difference is the server doesn't close when the player leaves, these are the servers you see for games like Rust

empty bluff
#

and if i start with 1 player = dedicated server and do same print out, i get one line: Server: Has Auth

kindred widget
#

@empty bluff HasAuthority simply checks the local role of the actor. This will return true on the machine that spawned this actor. So if it is a server spawned replicated actor, it will return true on the server machine regardless of dedicated or listenserver and that same actor will return false on the client if the same call is ran in client side code. However. That same client can locally spawn an actor and check HasAuthority and that will print true on the client, because the client is the one that spawned it.

lost inlet
#

if you use "play as client" mode in PIE, that emulates a dedicated server setup

empty bluff
#

which seem to live on both server and client

lost inlet
#

the hosting player will always be authority over their own listen server, other (non-local) clients will behave exactly the same as a dedicated server connection

empty bluff
kindred widget
#

In most cases, the argument between dedicated and listenserver is pretty moot if you code correctly. Listenserver client code will behave exactly like another client, and their server code will be isolated. In best case scenarios, you should be able to run your game as either a ListenServer or Dedicated.

lost inlet
#

then your test was wrong

#

this only applies to the hosting player

#

all other players will be identical in behaviour to a dedicated server connection

empty bluff
#

as i said, if i start as client (meaning i start a dedicated server and act as client), and do this printout from myplayercontroller it spits out two lines as i wrote above

#

try it yourself

empty bluff
lost inlet
#

then you walk it back

#

ok

empty bluff
#

may have been unclear

kindred widget
#

As a muddied window. ๐Ÿ˜„

#

But yeah. If you start as client. Anything will print HasAuthority until you join a session and load into the server map. The client will have created all of the objects until then and will have authority over them because until that point, they're basically a Listenserver with no clients connected. Then they join the server and become a client where most things are replicated to them and they don't have authority over them.

empty bluff
#

thanks for that clarification... do you also happen to know if there's a better way than what i asked a bit up?

#

this: "possibly a noob question, but if i from one client want to update all other clients hud (ie. when i write a chat message), should i go through a Server RPC and from there, access the gamestate's PlayerArray to get all the PlayerState and from there to the Pawn and then finally to the PlayerController or is there a more direct and correct way? See screenshot above"

kindred widget
#

Never made a chat myself. But in some form, it'll end up being ServerRPC from client with intended message, and then multicast RPC to all clients to send and display message. GameState would likely work for that, or more appropriately might be an actor component on the GameState actor maybe. Someone else may know a better place to put it. But on Multicast RPC received on client, you'd probably get the HUD and get the chat widget and call a function to store and display the new message.

empty bluff
#

right... i tried making a ServerRPC which called a MultiRPC which then did the update of the Widget...

kindred widget
#

Which actor did which RPC?

empty bluff
#

sry im new to Multiplayer, keep forgetting to include info... bare over with me

#

ThirdPersonChar currently has just a click event handler to send a fixed string (to be a chatmsg)

#

it does this by calling a ServerRPC

#

it does this by calling a ServerRPC

#

like this:

#

(on ThirdPersonChar) Execution pin coming from the ServerRCP

#

it somehow seems wrong to me to do this, but can't explain why it feels wrong, but doing it as shown below seems more correct, but also more convoluted

kindred widget
#

What does that last function do?

#

AddInfoTextClient

empty bluff
kindred widget
#

And when you run this, if you put a print on SentTextMulti before the cast, do you get a print on all clients?

empty bluff
#

on second thought... using the multicast version may be ok, since it ends up with the same number of calls anyway, or not?

#

sec

#

LogBlueprintUserMessages: [ThirdPersonCharacter_C_0] Server: Hello
LogBlueprintUserMessages: [ThirdPersonCharacter_C_1] Client 2: Hello
LogBlueprintUserMessages: [ThirdPersonCharacter_C_1] Client 1: Hello

kindred widget
#

What about inside of AddTextBox? Make sure execution is making it all of the way there.

empty bluff
#

see above screenshot

#

well, tbh, i think adding that print string answered my question

#

it only runs 3 times

#

my concern was that i was worried it would be called 9 times

kindred widget
#

Shouldn't be, unless you get every player character and run a multicast from all of them. Only this one character that was clicked should run the multicast.

empty bluff
#

right

#

so i just realized i don't need the Executes on owning Client

#

it was only needed for adding the main widget at PostLogin

kindred widget
#

Possibly. Careful with that too though. Under bad conditions, you'll end up with clients missing UI if a packet gets dropped from the server telling them to add something to screen. UI should most often be initialized on the client side alone and populated with data it already has, and then bind functions from other objects to let the UI update itself when new information is replicated and available.

empty bluff
#

won't it be 99,99% secure if i make it reliable?

kindred widget
#

Possibly. But why bother with it? Chat box is a great example. If a client logs in. Why wait for the server to tell it to add the chatbox? Just let it's HUD's beginplay add it. Zero network code, no lag/latency. If an RPC is sent with a message when it doesn't exist, it doesn't matter. Don't do anything with it. Client wasn't ready to receive messages at the time. It can just add the chat to screen and set up all of it's own pointers to be ready for the next chat RPC someone sends.

empty bluff
#

aha hmm, makes sense to use the HUD's beginplay yes

kindred widget
#

One of the greatest things about networking, is that you're going to be spending a lot of time finding ways to do as many things as you can to avoid networking.

empty bluff
#

when entering the lobby though, at game start, wont HUD's beginplay fire already then?

still rampart
#

Do I have to include something to use the _validation _implementation functions? Because when I append my function names with them they never compile because they are not included in the header

kindred widget
#

Not sure I follow? If you're in a lobby, and you start a new game, everyone's worlds are going to get destroyed, and a new HUD is going to get created anyhow. NewGameMode means new beginplay.

empty bluff
#

aha i didn't know that

#

aha i didn't know that

#

omg that worked like a charm, thx @kindred widget

twin juniper
#

Does anyone here know anything about Spatial OS?

empty bluff
#

follow up question: as of now, i have the widget stuff placed inside MyPlayerController, is there any particular reason i should not keep i there, or possibly move it to MyHUD?

lost inlet
#

why do I always see this getting used

#

in a UMG widget, there's the owning player

#

if this is a UMG widget for the chat

#

though an AHUD will also have an owning player controller

kindred widget
#

Personally. I prefer any and all UI stuff to go through HUD. Most game styles will already have a ton of logic going through controllers as is. Removing the UI to another class frees up a lot of complexity in the controller. And HUD is very easy to get with GetPlayerController0->GetHUD()->CastToYourHUDClass. So that makes it incredibly easy to get anywhere in code to have a client's local hud do something with UI it's handling.

empty bluff
#

another really good point man. I'll buy into that too...

odd iron
#

Hello Guys i was trying to replicate placable object Material dynamically change when player press a button i tried to get it work
.....
After thousand of Test this one work

#

Is this wrong or what ?

#

Because any change it will cause it work just one side either client 1 or client 2

meager spade
#

i would not use a multicast really for that

#

i would use repnotify property

#

also Has Authority on a server RPC...

empty bluff
#

@odd iron if i understand you correct, i think you should 1st call a ServerRPC and then from the ServerRCP call the MultiRPC to set the material, but i may be misunderstanding

meager spade
#

i really highly suggest reading this and understanding

empty bluff
#

@meager spade are rebnotifies reliable?

meager spade
#

ofc they are

empty bluff
#

aha, i wasn't sure, thx

meager spade
#

but they only update when the actor replicates

#

RPC can happen before an actor replicates

#

why lots of people fall into race conditions

empty bluff
#

ah that's what i messed it up with...

#

so if i would desperately need it to update, i could use repnotify and forcenetupdate?

meager spade
#

it will move it to be considered next frame

#

instead of its usual consider time

empty bluff
#

but may as you say, be better on network rather than RPC

meager spade
#

does not mean it will go the next frame, but will happen sooner

#

rpcs are fine

#

but RPC's are for one off events

#

like Explosions, etc

#

RepNotifies are for more stateful things

#

thing is a RPC only ever happens once, late joiners or people who were not relevant at the time, they will not get that multicast

empty bluff
#

i was chatting with a few before about sending messages to ie. a chat system or infopanel... would you say rpc's are better suited or RepNotifies?

meager spade
#

but they will always get the property update

#

well depends how you do it

#

but ultimately will be a Server RPC from client to server

#

then client RPC to the client who should get that message

kindred widget
#

Replication for chat should only be a consideration if you want to keep logs and update them when a client rejoins or a new client joins. Very few games do it. And for something like chat, it's kind of a waste on server CPU useage for the check to replicate.

#

Replication for chat should only be a consideration if you want to keep logs and update them when a client rejoins or a new client joins. Very few games do it. And for something like chat, it's kind of a waste on server CPU useage for the check to replicate.

odd iron
#

I have few knowledge about replication also ive tried to Replicate it from server but its just working on owner

meager spade
#

@odd iron those RPC's need to be on an actor owned by the owning client

#

not just any actor in the world

#

Multicast is an exception, can be on ANY replicated actor

#

but must be called only from server

odd iron
#

Yes

#

So this method is wrong i have to change it tomorrow

split siren
#

Good evening all, I hope you can help me riddle this out. I have a pawn and I want to teleport it after 2 seconds. This code teleports it on the server, but client stays on the same location. Any ideas what am I doing wrong?

#

I thought enabling Replicates and ReplicateMovement would be enough..

twin juniper
#

When using BP only, is it possible to define server name when hosting a server

crystal crag
#
if(CameraLockArm != nullptr && CameraLockArm->IsCameraLockedToTarget())
    {
        AActor* LockedTarget = CameraLockArm->GetTarget()->GetOwner();
        const FRotator NewRot = UKismetMathLibrary::FindLookAtRotation(GetActorLocation(), LockedTarget->GetActorLocation());
        SetActorRotation(NewRot, ETeleportType::None);
    }

I'm trying to implement a lock on to target feature. Is setting the player actor to rotate to always face the target a viable solution in multiplayer? Are there any pitfalls to doing it this way?

lone forge
#

how do I do this check without casting to the pawn?

#

I have an object with a collision that sets a variable, but I want it to only set the variable for the locally controlled player controller

#

it works, but I feel like there's a better way to do it

north heath
#

Is there any documentation on replicating behavior trees? I have replicated movement animations etc but the AI only acts on the servers player.

hollow eagle
#

Generally you don't want to... AI should only run on the server.

north heath
hollow eagle
#

you can do the AI in whatever you want, I'm not sure what that has to do with anything

#

BTs, blueprint, C++, whatever. Generally AI only runs on the server and whatever the AI decides to do is replicated to clients via normal means (character movement, triggering animations, etc)

#

pretty much exactly like a player would be... except instead of a remote client with some input device, it's an AI "brain" driving things.

nimble sinew
#

I've made a blueprint that extends "character", and set it so that this character can fly basically

#

and the players can see each other when they spawn in, but they cant see each other move/rotate/etc

#

what could be the reason for this? This is my character class:

#

all replication stuff is checked i believe?

#

do i need to be doing something special in the player controller class maybe?

raw quarry
#

I'm having trouble dynamically creating an actorcomponent with NewObject that replicates -- any suggestions?

#

I call NewObject in BeginPlay

#

and I have called SetIsReplicated(true) and implemented the getlifetimereplicatedprops

lost dune
#

I don't understand the multiplayer , In standalone i get a reference to the player character and work with in all the BP , now i am in a client server game , what should i replace this reference with? a foreach loop on all the player characters?

winged badger
#

@raw quarry the Actor Owner and the Component need to be replicated themselves

raw quarry
#

the actor owner is replicated, and I've called SetIsReplicated(true) on the component, which should cover both right?

winged badger
#

@lost dune you should really wait a couple of months with the multiplayer

#

you can't do MP without knowing any of the raw basics

lost dune
#

Is this about replication?

winged badger
#

show me the code

lost dune
#

relevancy?

#

i am just lost with all i readed

winged badger
#

basically

raw quarry
#
void ARevenBladeCharacter::PossessedBy(AController * NewController)
{
    
    Super::PossessedBy(NewController);
    
    //Initialize revenblade abilities
    if (characterAbilities && HasAuthority())
    {
        FString characterAbilityComponentName = "CharacterAbilities";
        characterAbilitiesInstance = NewObject<UCharacterAbilities>(this, characterAbilities, FName(*characterAbilityComponentName));
        characterAbilitiesInstance->setCharacter(this);
        characterAbilitiesInstance->SetIsReplicated(true);
    }
}
winged badger
#

you forgot to register

#

and 3 backticks ` before and after format the code nicely

#

like so

raw quarry
#

ah cool

#

what does register do? I'm assuming you mean characterAbilitiesInstance->RegisterComponent() ?

winged badger
#

you can add cpp after first 3 to get some basic syntax coloring too

nimble sinew
#

If I've got a dedicated server running is there an easy way to use it as a listen server too? I.e. see everything that is serverside

#

if I run it in the editor is that enough?

winged badger
#

all components have to be registered

#

those created in constructor get registered during actor setup

#

those spawned at runtime need register call done manually

raw quarry
#

o cool thanks for the tip on the discord tricks

#

and ahh gotcha, I'll give that a try

#

@winged badger any real difference if I do it in PossessedBy vs. BeginPlay?

winged badger
#

depends

#

if you let the World call DispatchBeginPlay or not

#

if the World did BeginPlay, then no, not really

#

its just few functions down the line

raw quarry
#

Ok yeah that's what I figured

winged badger
#

take note of AController::SetPawn

#

its the common function called on Client/Server

#

Server calls it from Possession code, Client from OnRep_Pawn

raw quarry
#

hmm it still doesn't appear to be working

#

is my HasAuthority() check correct? i.e. I create it on the server and it should automatically replicate the instance?

#

actually come to think of it.. should my 'characterAbilitiesInstance' variable be replicated?

winged badger
#

PossessedBy doesn't need Auth check

#

it doesn't run on clients

raw quarry
#

oh right

winged badger
#

characterAbilities is pretty bad name for TSubclassOf

#

if i didn't know the NewObject params off the top of my head, i would not be able to say what it is

raw quarry
#

Yeah that's fair

winged badger
#

you can also do TEXT("CharacterAbilities") and skip the FString part

#

replicating CharacterAbilitiesInstance pointer isn't a bad idea

#

as it will be null on clients if you don't

#

there are other ways to initialize it, like overriding OnSubobjectCreatedFromReplication

#

but that is way more trouble then its worth

raw quarry
#

gotcha, I'll give this a try

winged badger
#

the component is safe from GC even if not assigned to a variable as ReplicatedComponents TSet is UPROP

#

which mean you can probably find it in Locals on client inside that TSet

raw quarry
#

right right

#

hmm the component still doesn't appear to exist on the client

#

or at least characterAbilitiesInstance doesn't point to it

meager spade
#

Is it a component or uobject?

raw quarry
#

ActorComponent

meager spade
#

And you registered it ?

raw quarry
#

yeah

meager spade
#

Where

raw quarry
#
void ARevenBladeCharacter::PossessedBy(AController * NewController)
{
    //Initialize revenblade abilities
    if (characterAbilities)
    {
        characterAbilitiesInstance = NewObject<UCharacterAbilities>(this, characterAbilities, TEXT("CharacterAbilities"));
        characterAbilitiesInstance->RegisterComponent();
        characterAbilitiesInstance->SetIsReplicated(true);
        characterAbilitiesInstance->setCharacter(this);        
    }
}
meager spade
#

Hmm

winged badger
#

your declaration of the member and getlifetimereplicatedprops?

raw quarry
#
UPROPERTY(EditAnywhere, BlueprintReadWrite, replicated)
    UCharacterAbilities *characterAbilitiesInstance;
meager spade
#

Registering should add it to to the replicated comp set

winged badger
#

also worth checking is it exists on server, as the class might be null

raw quarry
#

and I have DOREPLIFETIME(ARevenBladeCharacter, characterAbilitiesInstance);

winged badger
#

with a Super call included?

raw quarry
#

yes

#

all the other things I have replicated there work properly

winged badger
#

i mean your PossessedBy doesn't seem to have it

#

so wondering if its a pattern ๐Ÿ˜„

meager spade
#

Also never use edit anywhere and BP readwrite on a pointer like that fyi. Just asking for someone to break it.

raw quarry
#

yeah I just deleted the rest of the code in possessedby since it's not relevant for the code snippet

winged badger
#

does the component exist on server?

raw quarry
#

hmm actually something else seems to be going wrong

#

attached some debug stuff and it actually looks like it's a valid object on client and server

#

so something must be going wrong with what I'm calling on it

raw quarry
#

got everything working now, thanks guys ๐Ÿ™‚

bitter swift
#

How do you replicate a construction script on an actor?

thin stratus
#

You don't. It triggers for each instance anyway

#

Otherwise use BeginPlay

bitter swift
# thin stratus You don't. It triggers for each instance anyway

Yes I discovered that too. Sorry I should have been more specific.
I need to set the initial speed of a projectile based on a variable that is exposed on spawn. But that variable is always 0 on clients. It's the same result even when i set the variables to replicated.

thin stratus
#

You'll need to use BeginPlay then

#

Exposed on spawn variable has be set to replicated and you need to use BeginPlay for that

bitter swift
#

does begin play work for setting projectiles initial speed though?

#

Let me get out of bed and on my computer to check it out ๐Ÿ˜„ brb

thin stratus
#

It should

#

Otherwise just override velocity

bitter swift
#

thank you @thin stratus ill try it out

bitter swift
# thin stratus It should

it does run on the clients, true. But the projectile only accelerated at it's default :S
the 6000 did not come into play. The projectile was still very slow

thin stratus
#

Just override velocity then

bitter swift
twin juniper
#

I have a car with a collision box, when someone walks in that box a widget should appear for the client. Does anyone know the method for this?

#

I've tried 4 different things, and each one causes the widget to appear on the server only, or not at all. I can't get it to appear for clients

thin stratus
#

Not sure how you setup your whole interaction widget stuff, but the idea is that you show it only in the Local Client.
If the Widget gets spawned in the Car BP, then the Overlap is probably giving you the Character that overlaps.
You can then check if that one is LocallyControlled and only show the Widget there.

Other setups could have the Overlap happen in the Character itself, where you can do the same check to show the UI.

twin juniper
#

@thin stratus How do you show it in local client? That is most likely my problem

#

Oh I figured it out, just needed to read what you said 100 times to fully understand it lmao thank you so much

modern swift
#

anyone know where can find the overview for unreal low level network works 1. I want to know the information about encryption and compression of packet . 2. I heard UDP have NAT problem when server send pack to client , how does unreal handle this case, would it switch to TCP automaticlly?

twin juniper
#

Hey guys i wanted to know can AdvancedSessions/Sessions be used to make an android mulitplayer? is it possible?

empty bluff
#

if i have a MainMenu Level, and my HUD class is set to none, then when i select Host game i load up a new level. Once on that level, i want to initialize my players UI (Widgets) from MyHUD. What i was hoping i could do, was to change the HUD class to MyHUD class and utilize the begin play event then, but it seems ie. Level beginplay is too late to change the HUD class.

bitter oriole
#

(NAT isn't a problem on modern platforms - Steam makes it a non issue if you're there, and if not, get yourself a NAT punch library)

kindred widget
#

@empty bluff Just make a separate GameMode for the main menu or other levels that don't need specific classes like that and set the level's game mode to that game mode. Then use your normal game mode in your game levels.

#

Or use the base game modes that default to native classes. Either way.

empty bluff
#

hmm, can't find where i define GameMode for the Level... i thought it was worldsettings, but that seem to be shared accross levels

blazing cloak
#

Hello. In Fps game I spawn some actor and attach it to camera i server RPC. All other cluents see my actor infront of me, and that is ok. But, when I rotate camera up or down, only server see update position and rotation (essentialy player that spawned the actor always look in to it, like crosshair) on player that moves camera. Spawned actor is replicated with replicated movement. What am I missing?

kindred widget
#

Open your level, and go to the world settings tab and change it there. Usually right next to the details or world outliner. It should only change it for that one level.

empty bluff
#

ah got it... i was changing HUD for the same GameMode... silly mistake

narrow totem
#

hi, how can i create a sword collision which will work for multiplayer, like dealing damage to other players.

winged badger
#

same as you would for single player

sand dock
#

does any have any experience with ios networking?

narrow totem
#

this is not detecting other players

#

but it detects other things

#

how can i fix it what is the issue here anyone knows it?

sand dock
#

ok, in case anyone else runs into this issue.... Found why my ios game was crashing on joining... by default it was pulling the configs from the engine defaults iosengine.ini and setting DefaultPlatformService to IOS, setting this manually to Null resolved my issue.

blissful fossil
#

is there an alternative to using the built-in high level networking in UE4? like the replication systems, smoothing, etc.; everything

hollow eagle
#

You can write your own networking layer if that's what you're asking.

#

or use whatever third party libraries you want, but you're pretty much on your own for either of those options

blissful fossil
#

right, that's what i presumed but in another discord we got into a deep, heated discussion about whether that's possible; and some folks seemed pretty adamant that you couldn't

#

or not that you couldn't, but that it would be several orders of magnitude more difficult in UE because of how tightly the built-in network is entangled with the engine, to the uobject level

hollow eagle
#

it's absolutely possible

#

just don't use unreal's built-in networking

#

I doubt you can entirely pull out the built in replication framework (it's pretty heavily integrated into everything) but you can just... not use it

blissful fossil
#

right, that's what i thought

#

do you know of any games that do that?

hollow eagle
#

I think @chilly mason is doing that for his game - iirc he's doing lockstep networking which isn't exactly easy to do with the built-in replication system. Also any game that does true P2P networking though I don't know of any UE4 games like that off the top of my head.

chilly mason
#

Bannermen

#

what

hollow eagle
#

you have your own custom networking, right?

chilly mason
#

yes

#

and Bannermen is a ue4 rts that uses lockstep

hollow eagle
#

ah

hollow eagle
#

wasn't familiar with that

chilly mason
#

of course they're nobodies since they're using photon

hollow eagle
#

was gonna say, photon too... hmm

chilly mason
#

also, they went fixed point and not floating point

#

so they're loser nobodies.

#

:>

blissful fossil
#

LOL is that like an in-joke I am unaware of ๐Ÿ˜†

chilly mason
#

(obviously just kidding, for the overly sensitive trigger happy lot watching)

blissful fossil
#

sounded spot on

blissful fossil
#

(as a joke I mean, people ripping on people using off-the-shelf networking solutions)

#

oculus start

chilly mason
#

yeah not on there

winged badger
#

you have plenty of options for your networking with unreal network

chilly mason
#

here's a very crappy demo of my lockstep

winged badger
#

very few things you can't do (host migration)

blissful fossil
#

this dude was adamant that you could swap out the subsystem for a p2p system (like oculus p2p or steam, or EOS p2p) but you'd still be using the built in networking and thus the listen server, tickrate, replication stuff etc. (which obviously is true), and that building your own networking layer that circumvents that stuff entirely would be impossible for anyone but a AAA dev team

chilly mason
#

I gradually increase the unit count to 5000 I think

#

there's a big delay b/c of teamviewer, one compute is in the EU and my connection from here to there is abysmal

#

*computer

winged badger
#

would need 2 minions and about a year for that i think

chilly mason
#

I'm not using anything from ue4 networking apart from FSocket

#

took me about 2 months I think with zero networking know-how so I imagine someone slightly experienced could pull it off in a month

winged badger
#

writing separate network using sockets is one thing

#

getting unreal replication system to work p2p

chilly mason
#

I'm not talking about what Prime was describing

winged badger
#

keeping all the options, having robust code, etc...

#

would take significantly longer

blissful fossil
#

right no, i was asking the opposite, just writing your own networking layer and doing all the replication and stuff yourself

winged badger
#

testing alone would take 2 months

blissful fossil
#

pretty much exactly what @chilly mason is doing here

blissful fossil
#

my man

meager spade
#

2 months with experience and it working, but what about all the edge cases and issues?

chilly mason
#

not sure there are many edge cases

#

haven't had a single desync in Shipping code so far

#

it's more like a fixed set of challenges to solve as opposed to client-server which is a lot more complex w/ a lot of crap

meager spade
#

what library did you use ?

chilly mason
#

for what?

meager spade
#

your P2P networking

blissful fossil
#

but bottom line: if i were capable of, given only a low level networking library capable of connecting clients and firing bytes to each other, build my own high level networking framework for a game with parity to something like photon (replicating properties, sending messages, smoothing and correction, delta compression, etc) in another engine, is it safe to say I could probably do it in UE4 as well?

chilly mason
#

not sure what you mean

winged badger
#

Glass likes to do stuff himself ^^

meager spade
#

including the tcp/udp transport layer?

chilly mason
#

udp

meager spade
#

interesting

#

so you didn't use a base framework for your UDP stuff, just did it all yourself?

#

only stuff i have done, always used ASIO library

chilly mason
#

I'm using FSocket from ue4, that's pretty much it

meager spade
#

in my Flight Simulator programs, i used ASIO as the library for that, its really easy to use

blissful fossil
#

@chilly mason so your game is true p2p then? there is no listen server/master client

#

like the old 100 archers paper

chilly mason
#

exactly like that

blissful fossil
#

awesome

chilly mason
#

I wrote a small matchmaking server w/ NAT punchthrough

#

since you need that sort of stuff for p2p

#

and to my detriment I've chosen std c++ for that which I kinda regret :)

#

might do a rewrite as a ue4 Program

#

what's cool about p2p is that you don't need to pay for servers

#

just need 3 potatoes to do the matchmaking for like $5/month each, one in the US, EU and Asia

#

of course players can just set their p2p up directly but routers are a pain in the ass so nat punchthrough is good to have

blissful fossil
#

well im just a nobody so i use photon

#

๐Ÿ˜†

chilly mason
#

aren't they expensive?

blissful fossil
#

eh, kinda

#

$95 one-time for 100ccu, $95 a month for 500ccu

#

i'm making a VR game for Oculus Quest so if I broke 500 ccu I'd be in like the top 5 games on the platform so I'll cross that bridge when I get there ๐Ÿ˜†

chilly mason
#

hehe fair enough

twilit radish
#

You also pay for traffic with at least PUN.

chilly mason
#

oh yeah that's another issue huh

twilit radish
#

Thatโ€™s for me the major issue, because the more people play the more bandwidth they use lol. And it also of course heavily depends on your game. If it was for just the CCU limit then itโ€™s no problem, but unfortunately ๐Ÿ˜…

chilly mason
#

yeah

#

my bandwidth is not that optimized but it's only around 1500 bytes per player

twilit radish
#

Per second?

blissful fossil
#

yeah, the 500 CCU plan comes with 1.5TB, given my compression and messages/sec I think I would come under that

#

er well not if people played 24/7, I guess that'd be tough to evaluate haha

twilit radish
chilly mason
#

I'm compressing and encrypting all my traffic

#

don't ask why I encrypt, I probably just wanted to try that stuff out :P

twilit radish
#

Does anyone know what the most used cross play services are used with Unreal? I know Playfab and Photon exist, are there other good ones though? As I assume we donโ€™t truly know the most used one

#

I recall seeing a list somewhere but I canโ€™t find it anymore ๐Ÿ˜”

hollow eagle
#

define "cross play services"

#

none of the things you mentioned have to do with crossplay specifically, and photon is not the same thing as playfab

twilit radish
#

Services that allow me to play with friends over multiple platforms without having the limitation of โ€œI play on a console so I canโ€™t play with you on Steamโ€

#

So basically relays

hollow eagle
#

that's not really what's required for crossplay

winged badger
#

just need a matchmaking server

hollow eagle
#

the only thing that matters for crossplay is a way to verify/manage accounts from different services

#

and matchmaking ^

twilit radish
#

Sorry not relays yeah

#

Altough may also be needed I guess

chilly mason
#

doesn't ue4 have an off the shelf matchmaker

hollow eagle
#

playfab does that to some degree, EOS does it, I don't know that photon has that

chilly mason
#

via epic online services

hollow eagle
#

not really built-in

#

but yeah, I think EOS has a matchmaking system.

#

so does playfab

chilly mason
#

if you're interested about playfab btw microsoft is holding a larger conference

#

apr 20-21

#

(there's also graphics and other tracks)

twilit radish
#

I still feel like Iโ€™m not understanding this correctly, a โ€œmatchmakerโ€ is what connects people right? If it was a dedicated server it would connect people to that dedicated server, but what about listen servers. I donโ€™t assume that handles connecting people to each other through whatever necessary right?

#

As probably the best example a router of someone blocking direct connection with the listen server someone has on their PC. How do services fix that issue?

chilly mason
#

in the context of p2p, a matchmaking server is what does nat punchthrough (to get around routers) and also what keeps track of active players/sessions

twilit radish
#

Does NAT punch through always work though?

#

To my knowledge it doesnโ€™t always succeed right? What then? Or does it always work?

chilly mason
#

player 1: I want to play with player 5
matchmaker: player 1, open a udp port and tell me what it is (along w/ your ip)
matchmaker: player 5, open a udp connection to player 1's ip and port
player 1 & 5 can now connect to each other

#

if nat punchthrough doesn't work then you either tell them to set their router up or use something like steam's network thing

#

which is a relay service

hollow eagle
#

or just don't let that player host a listen server (if that's an option)

chilly mason
#

there are no listen servers in p2p

hollow eagle
#

fair, but nat punchthrough is still relevant to listen servers ๐Ÿ™‚

twilit radish
#

Are there any services that provide all these things, is that even common or is that something no one offers? Or is NAT punch through failing such a small chance that no one cares about it?

chilly mason
#

Steam provides it for free provided you use steam sockets

#

they're called relay servers I believe

#

Steam Datagram Relay [BETA]

#

NOTE: Carrying traffic to your dedicated servers over SDR is a beta feature, and is not a Steamworks feature we can offer to all partners at this time. There may be technical or capacity issues that prevent us from offering it to all partners.

#

it's practically a mini internet of Valve's

#

afaik dota and starcraft have similar constructs

#

pretty sure Photon has something like this

#

and are making good money on it too :P

winged badger
#

the matchmaking server just needs to send an instruction to the host server to send a message to all clients

#

so its router doesn't discard messages from them

twilit radish
#

Thatโ€™s what Iโ€™m trying to figure out though, because the limitation with using that for free is rip crossplay for other stores. Is it even possible for small games to use services that provide this without dying because of lack of money instantly? The other problem of course is that if a store or platform doesnโ€™t offer such a free service then itโ€™s also a rip.

winged badger
#

obv not required for public server

hollow eagle
#

Your question is at least part of why P2P is uncommon these days - autoscaling dedicated servers isn't hard and it's generally simpler to use dedicated servers than P2P.

chilly mason
#

and way more costly

#

infinitely more :D

#

there was a GDC talk about this btw hold on

hollow eagle
#

definitely, but if your alternative is either a bad experience or relays (which also cost $ if you can't use a free service like steam's) then it may not be much worse

#

as with everything, "it depends"

twilit radish
#

Dedicated servers are much more costly than just relays / matchmaking servers to my knowledge because you obviously also need to host the servers.

chilly mason
#

the good thing about relays is that they're relatively simple to write for yourself and then it's just a matter of finding some potato servers around the globe that have your bandwidth requirements

#

simple b/c all they do is forward network traffic

#

I think it was this

twilit radish
#

I mean yes, but you also need to host it all your self then and keep it all up. Which may not even be too bad when youโ€™re a small game I guess.. Along with a matchmaking server of course. But that does become a rip if you probably get more than like literally a few people. The bigger it goes the worse it gets ๐Ÿ˜…

chilly mason
#

hosting a server these days is dirt simple

#

digitalocean -> create droplet -> yes -> install docker -> server is up

#

you can go a step further and configure some azure / aws scripted nonsense

#

or just write a simple script that pings your servers and if there's a timeout just send reboot over ssh :P

#

but you only have to worry about any of that once people are playing your game, at which point you should have ๐Ÿ’ธ for better infrastructure

#

so she's saying that "p2p is extremely complicated" -> ignore that :P

#

"the reason it's the default option is b/c it keeps things cheap"

twilit radish
#

The video was pretty interesting, thanks for sharing ๐Ÿ˜„

#

Didn't watch all of it, but a decent part was interesting to me ๐Ÿ˜›

mild forge
#

Hello, we are currently developing a game using steam sessions. When the game is completed we want to send the players to an EndGameLevel which then leads to the MainMenu. However, we are not sure where and when to call the destroy session function. In certain, cases if the server calls destroy session before the client the game crashes for the players. In other cases, both players are able to return to the MainMenu but none are able to create or join another session without closing steaqm and reopening it (hinting towards the session still being in progress).

TLDR : Where and when do we call the destroy session BP? Client? Server? Both?

#

Also our game has two players, and is run as a listen server.

winged badger
#

BeginPlay in MainMenu

sand iris
#

Is #if WITH_SERVER_CODE supposed to be only defined in server builds? meaning that all the code I put inside that preprocessor statement will not compile on client builds?

It seems like it's defined to "1" in every single file so I'm confused. How am I supposed to find out how things like these work?

winged badger
#

its stripped before compiling, yes

sand iris
bitter oriole
#

It's a preprocessor definition

#

So the compiler evaluates it when compiling and processes #if WITH_SERVER_CODE blocks accordingly, keeping or removing the code within

stray oxide
#

Hey guys, how would I go about networking a double door and having both doors open at the same time? So basically I am calling a Server RPC to open the door, which calls a multicast RPC to perform the animation of opening. One of the doors open at a time but I think that it is dropping the function of the other door due to reliability. I will post screenshots to clarify when somebody replies, I don't want to flood with screenshots

quasi tide
#

I would think that you'd want to use a rep notify to open/close the door because you're changing state. A pretty simple state, but changing state none the less.

stray oxide
#

I tried the rep notify and it worked but it was still the same issue. Only one door works at a time for some reason. I think it has to do with trying to run two RPC's at the same time and it drops one of them.

silent valley
short arrow
#

do anim blueprints not replicate automatically? Should I just do everything in montages???

silent valley
#

Anim BP will not replicate, you need to replicate the state that drives the anim BP.

short arrow
#

method please kappa?

silent valley
#

Say you have a bool which you read in the anim BP to switch pose or whatever, the bool itself should be marked as Replicated.

short arrow
#

oh I see thank you

stray oxide
#

I am running that after a few checks but basically just when I press F it calls both of those

silent valley
#

I suspect your problem is perhaps in the Open Close function, calling two reliable RPCs like that is a bad idea, but should still work.

stray oxide
#

Yeah I figured that was the issue but I cant seem to think of a way around it. I was thinking maybe just doing two collision boxes and open the door that they are standing in or something like that. A little bit more annoying but probably more reliable.

silent valley
#

No, replicated bool for state is the way to go, and observe changes in state via OnRep, as the other guy said before.

#

Player approaches the door and sends RPC to server which just changes the bool

#

OnRep is fired when bool flips to open and you play the animation

stray oxide
#

ill try that out again, I have a bool already set up for it with an on rep from when I did it before but maybe I did it wrong, im gonna try again now

silent valley
#

Make sure you only write to the bool from within Server RPC, clients should generally never modify replicated vars.

stray oxide
#

I tried that, it did not work, I tried a few different ways. I am a bit tired now though so I will have to continue looking at it another time. Thank you for helping me with it! I'm sure tomorrow when I look at your messages my brain will process it better lol

chrome bay
#

That function name gives an idea what the issue is. Are you changing the bool to true then back to false or vice-versa in quick succession?

#

If you do that, there's every chance it will never replicate because the next time the actor is considered for replication, the server sees it in the same state the client currently has it. If you must open/close things quickly, an incrementing counter is a better/safer approach.

stray oxide
#

Ahhhh yes, I need to have two separate bools, one for each door?

chrome bay
#

No you need a counting integer or byte, increment it by one for open, and again for close. Use modulus on it to determine whether it's odd/even and therefore it's actual closed/open state

#

Two bools could still have the same issue

#

It helps if you remember that you aren't guaranteed to receive every change made to a variable, only it's final state. If the server thinks the client is already in that state, it won't send anything.

#

So incrementing a counter is a more reliable way of making sure the server sends a change

stray oxide
#

Oh okay I understand what you are saying. I will implement this tomorrow, thank you!

bitter oriole
#

Advanced sessions is just Blueprint for the online subsystem

twin juniper
#

so it will work if i set the subsystem to GooglePlay?

chrome bay
#

Pretty certain GooglePlay doesn't have a sessions implementation.

#

Just identity/purchases etc.

#

Oh and achievements

twin juniper
#

oh how can one make a android multiplayer using UE

chrome bay
#

Google in "drops support for something" shocker.

#

I'm not familiar with google and what services it actually provides for games - but my best guess looking at that, is that you would need your own master servers to advertise and find sessions. Such a thing is far from trivial to implement and support (and obviously not free). You could probably support LAN sessions easily using the engines' basic net driver if two devices are on the same wi-fi network.

#

There's bound to be a few topics on this out there though.

#

I learned my lesson with google/mobile, and that lesson was "nope".

twin juniper
#

so in other words currently its not possible for a solo dev got it

bitter oriole
#

I mean sure it is, with your own service, possibly EOS

#

But multiplayer mobile is tricky and Unreal's multiplayer model is built for real-time action games

#

Mobile multiplayer is often more of the slow burn type

hybrid zodiac
#

Hi everyone. I'm using seamless travel to have the server change maps, but I want to ensure that all players clear their viewports. I have an issue right now where if a player had a menu up when the map changed, then an orphaned copy of that menu remains on the screen, and pressing the menu button again just brings up a second copy over the top.

#

Is there a function in C++ I can override to capture the point at which clients seamlessly travel, so I can add a bit of code to close all open menus?

#

I tried doing it in the loading map blueprint within BeginPlay, but it doesn't seem to work

meager spade
#

player controller

#

PreClientTravel

hybrid zodiac
#

Ah lovely, that gets called during a seamless travel as well?

#

Ah sorry, just looked at the function definition and there is a parameter for whether it is seamless

#

@meager spade Thank you ๐Ÿ™‚

woven sinew
#

anyone followed "Unreal Engine 4.26 Steam Multiplayer Beginners Tutorial" video ?

#

I don't understand how the game can find a session like that out of the blue over the internet

#

he tests a listen server both with and without steam

quasi tide
#

This one?

woven sinew
#

I think it still uses steam in both cases

quasi tide
# woven sinew I think it still uses steam in both cases

Anywho - yeah, that's what I used to be able to get my stuff connected across the net. Steam has to be running though. Which, personally, I'm not too concerned about at the moment. I'd like for it to be platform agnostic, but I'm not at that level just yet. Shouldn't be too much of a headache to change over once I am at that level though.

Are you just unsure how the connection works?

woven sinew
#

yeah the video just isn't very clear

quasi tide
#

In what way?

#

You get routed through Steams servers

#

You use their services to find hosted games

woven sinew
#

He does [OnlineSubsystemSteam]
bEnabled=false and it still works

#

i know

quasi tide
#

What timestamp?

woven sinew
#

15:57

quasi tide
#

He keeps it as true

woven sinew
#

but says you can debug with false

quasi tide
#

Turn it to false and give the packaged game to a friend.

#

Then just start it up.

#

Try to connect to each other

woven sinew
#

with sessions ?

quasi tide
#

Yeah.

woven sinew
#

with no ip ?

quasi tide
#

Just keep everything as is, change that to false

woven sinew
#

and it should work ?

quasi tide
#

Try it

woven sinew
#

I will, rn I'm getting "LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()"

#

and searching through the discord's history it seems I'm not alone lol

woven sinew
pallid canyon
#

even if it's not working, should send you in the right direction

woven sinew
#

yeah I've read that

pallid canyon
#

I suggest re-reading it to get new understanding for the questions you're asking: "By default you will use the 'SubsystemNULL'. This allows you to host LAN Sessions (so you can find Sessions via a Server List and join them in your LAN network) or join directly via IP. What it doesn't allow you, is to host such a Session on the Internet."

woven sinew
#

ok

#

so wouldn't work just setting false

pallid canyon
#

In the compendium it describes why it wont work.

woven sinew
#

yeah so I was right that the video is wrong

#

anyway

pallid canyon
#

is it? I thought it said you could disable subsystem to troubleshoot, i.e. test on lan that your listen server is working

#

that's the implication at least

woven sinew
#

I understood it as disabling and keeping everything else, i.e finding sessions on other networks

night tartan
#

Anyone experience "NumOpenPrivateConnections" from an FOnlineSessionSearchResult always returning 0?

#

sorry, Public, not private

#

Result.Session.NumOpenPublicConnections is giving back a 0 on a LAN setup no matter how many clients I toss into the game

#

.< I mean it's open, all of them are open; I'm getting my numbers all mixed up

#

so my math, which is NumPublicConnections minus NumOpenPublicConnections is always returning 0 for how many players are in the game

wheat grail
#

Hey guys, how is going? any hints on what can be causing the visuals going twice as fast in the autonomous proxy? I started to port my game to multiplayer and I wondering what can be causing that

winged badger
#

Listen server visual glitch?

#

CMC

#

it ticks the skeleton an extra time

meager spade
#

ah we had this once ๐Ÿ˜„

#
    if (Mesh && IsReplicatingMovement() && (GetRemoteRole() == ROLE_AutonomousProxy && GetNetConnection() != nullptr))
    {
        Mesh->bOnlyAllowAutonomousTickPose = true;
    }``` was caused by this being false
#

this is set in PossessedBy in ACharacter

winged badger
#

love how all that Character stuff consistently breaks encapsulation

meager spade
#

yh

craggy void
#

Hey guys. I'm working on a grenade mechanic in a third person shooter. Have been going back and forth between using simulated physics with an AddImpulse to launch the grenade - which generally looks the nicest but is quite random at times, and very janky when replicated to clients - and using a Projectile Movement Component with bounce enabled. The PMC seems to produce the most reliable results so far, but my biggest issue with it is that the grenade just keeps the orientation it had when it left the hand. As my grenade model is cylindrical, it looks like the characters is always winning the bottle challenge because it never falls over. Anyone have any tips for that? The PMC tutorials I've found all seem to use simple spheres as an example

dark edge
#

Also I'm pretty sure the projectile movement component supports spinning

meager spade
#

if not can use a Rotating Component

limber mortar
#

I spawn a lot of fire particles via multicast in a controlling actor in my levels, it burns across the map. Is there any value to passing all the player controllers an array of vector locations, and having them spawn particles on client only?

#

Versus my 1 multicast of the same array

clever swan
#

Hi guys,
I made a class SoldierTeam which stores data of one team of ASoldiers (a character for AIs and players). In this class I have a TArray of pointers of ASoldiers that I'd like to replicate. I want this array for the UI. Unfortunately, the array is empty on client side. My soldier class and SoldierTeam are set to replicated. Also I made sure my array is replicated with UPROPERTY(Replicated) and GetLifetimeReplicatedProps.

Any idea where could be the issue ?

#

I read somewhere that an actor should have an owner to be replicated. In my case, a soldier has its controller as owner on server side. Can't be possible of course on client

thin stratus
#

The owner stuff is for RPCs. Simple replicated variables aren't needing that.

#

Ist that actor set to replicate?

#

What type is SoldierTeam of anyway?

#

@clever swan

dark edge
somber glade
#

Running into an odd situation. I have check points for multiplayer. Since these light up and track each player's progress, the best way I could think of to deal with that is have the checkpoints laid out on the map, with an index variable (0 to however many is on the course) and then set them up to "only owner see". Then before play starts, go through the checkpoint array and duplicate all the checkpoints for each player connected, it spawns a new copy of the checkpoint on the same place, and sets the player as the owner. This is a function called from the gamemode, so it has authority. The problem is, the function seems to be executing, but I'm getting weird results: I already have Checkpoint0->X in the level, but when I run the foreach on that array of checkpoints and spawn a new checkpoint in the exact same spot, the result is a checkpoint with the exact same name. Doesn't make any sense to me. I figured that when it spawns a new one, it should keep adding to those numbers, so if the last checkpoint for player 0 is 28, then the first checkpoint for player 1 would be "checkpoint29" or something like that. Instead, the arrays for player 0 and player 1s checkpoints seem to be printing as identical.

#

I've set a breakpoint and a print right after the spawn and verified that the actor it's spawning has the same name.

fossil spoke
#

Why not just have the one set of Checkpoints and they keep track of each player that runs over them in an array?

#

Why do you need separate checkpoints is a question.,

somber glade
#

Because they have visual effects that need to be shown to each player.

fossil spoke
#

So only trigger the effects on the local player if that player was the one to overlap it first?

somber glade
#

it's got nothing to do with being first. The next checkpoint shows as a different color so that players know where to go, this is flying so it's not like there is a track to follow. The next 3 checkpoints are visible to the player.

fossil spoke
#

Ok so if its not about first, then just trigger the effects when the local player hits the checkpoint

#

You dont need to have separate sets of checkpoints for each player.

#

If they are all identical.

somber glade
#

A check point will either be "next checkpoint color", "future checkpoitn" or "invisible"

fossil spoke
#

Just check if the pawn that overlapped it has a locally controlled playercontroller, if it does, trigger the effects change.

somber glade
#

We also have local multiplayer.

fossil spoke
#

Well, think about the necessary components you have available to you that will be able to filter out the appropriate time to trigger the effects for the appropriate Player...

#

Just check if the pawn is an Autonomous Proxy...

somber glade
#

With 2 player, we just duplicated the visual effect and had a "only owner" and "not owner" but we've increased to 4 player local and maybe 6 or 8 online. With 4 player local we can't do that anymore

#

so we came up with this solution that works in both scenarios.

fossil spoke
#

๐Ÿคท

#

Fine, go for it.

somber glade
#

How else can we split that up for local multiplayer? The whole "local player" doesn't work there.

#

because everyone is on the same machine.

fossil spoke
#

I just told you how it does

#

Oh you mean splitscreen...

somber glade
#

Yes.

#

As far as I know you can't hide things from split screen players unless you use only owner see.

fossil spoke
#

Ive never worked with Splitscreen so im not sure if it creates multiple worlds for each player.

somber glade
#

It doesn't

#

they all reside in the same world.

#

which is why we had to duplicate the checkpoints and set them only owner see and set each player as an owner for a set of checkpoints.

fossil spoke
#

Ehhh that still seems like a terrible workflow.

#

Im not sure on what approach would be best then. Maybe that is the only solution.

somber glade
#

The only way I could see modifying that would be to have a checkpoint actor that is tied to a set of checkpoint emitters.

#

one emitter for each player, which they are the owner of.

#

On begin play have the checkpoint spawn an emitter for each player and set them as owner.

#

then update the emitter as the player overlaps.

#

That would probably work fine in online play as well wouldn't it?

#

and keep things simpler.

manic agate
#

hey guys, I'm receiving the following error when calling a server RPC:
"Error: Replicated TMaps are not supported."

The thing is, I'm not sending any TMaps to the RPC. I'm sending a USTRUCT (aa blueprint one, created within the editor), which in turn contains other structs and an array of a struct. NONE of the inner structs use TMap either.
What's up with that? I don't get it

#

Is there maybe a limit on the number of struct that a struct can contain when it's sent through a RPC or something?

#

Whooops sorry, he's right, someone added a TMap to one of the struct

#

My mistake ๐Ÿ˜„

thin stratus
#

@somber glade You have to think a bit different for Local Multiplayer. Instead of having a Checkpoint per, you could simply have 4 indicators on one checkpoint. E.g. colored.
That way you can keep one Actor for Online and Local. Have the Online one only show the effects on the local player and for Local Multiplayer you simply update the specific indicator on the checkpoint.
It might also help to check how other games with local coop solve this.

somber glade
#

I'd be worried about that being overly busy on the screen for the players, but I could try that as well.

#

since we're flying and we can have tracks that cross back on themselves, we're only showing 3 checkpoints ahead

thin stratus
#

Yeah, I would experiment a bit before spawning multiple checkpoints in the same place

#

But I would 100% try to think different about local vs online

#

I made a local & online game and we had to rethink a lot of "easy" online solutions for splitscreen

#

I mean sure, you can spawn 4 checkpoints

#

Make each player the owner of one

#

And hide them via the owner only see stuff

#

If you can make sure that this doesn't affect performance and doesn't break (cause you most likely need to either spawn them dynamically with a "Spawner" that sits where the checkpoints should be, or update 4 pre-placed ones accordingly), then go for the simpler solution.

somber glade
#

We've already got, the set of checkpoints in the level. My solution was to have the checkpoint manager go through and use that to duplicate it for the rest of them. seems to work fine in local, but in multiplayer, as I indicated above, when it was duplicated the checkpoint it was returning a result with the same name, which made no sense to me.

For example: CheckpointArray[0] had Checkpoint so I took the transform and other important information from it (index, course, etc) and just spawned a new checkpoint with those variables but set a different owner and stuck a different player number in it. When it spawned, print was telling me that the new actors name was "Checkpoint" just like the one it was spawned based on

#

Even if I go a different route with the checkpoints, I'd like to understand why that was happening.

normal violet
#

I've got an issue with getting my widget to work on my clients. I got a bind in the widget to show the gamescore (as you can see in the image). Now this works for the listen server, but the clients do not see it. When i just print the gamescore from the playerstate, it's updated, so I know my score system is working. I really have a feeling it's in this bind... Anyone knows what my problem could be?

quasi wyvern
#

can someone point me im the right direction here? on "gamemode post login" I am adding the new player controller to an array. after that, i want to run an event on the newly connected client, initiated by the server.

but the result is always that the event is execute by the server...

quasi wyvern
#

not my first network bp but i am often unsure about rpc event settings in those cases...

dark edge
#

@quasi wyvern that should be a run-on-owning client event if you want to call it on server and run it on client

quasi wyvern
#

@dark edge thx, tried that on both events and on each individually, but nothing happened :/

normal violet
# normal violet I've got an issue with getting my widget to work on my clients. I got a bind in ...

Ok I did some more debugging and testing setting gamescore from the pawn and from the gamemode and now I'm even more confused ;). I think I tried all of the run on server / multicast combinations here but I can't seem to get the client to correctly update the playerstate even If I'm asking the server to do it for me. I think I'm using the wrong google searches as well since nothing pops up that even remotely looks like my problem ;).

#

It all works on both the client and server when I use a test pickup which sets all values in the playerstate. :/. So both the widget and the playerstate get properly updated. Setting the playerstate variables to replicated didn't change anything btw, I just tried a lot of stuff ๐Ÿ˜‰

meager spade
#

well you have a server RPC in game mode

#

client can NOT access GameMode

#

so how will that server RPC ever work?

#

i really suggest you read the network compendium

#

you have done things really wrong

high current
#

how hard would it be to be able to connect two PIE sessions together

#

or editor standalone instances

dark edge
#

Routing might get a bit weird but you should be able to launch game twice, have one open a map as listen, and the other open localhost or 127.0.0.1 or whatever.

#

Won't work with Steam tho, you need 2 computers and 2 accounts for steam sessions.

high current
#

oh sorry I meant two pie sessions across two computers

#

obviously you can connect two pie sessions locally, thats what unreal does by default to get X number of players working

dark edge
#

@high current simplest and most basic way is just to "open hostip" and it'll work.

#

You'll need to port forward if it's over the internet.

high current
#

I remember that not working

dark edge
#

I would make a main menu, and have a host and join button. Host opens map with listen option, join opens the IP

high current
#

something with editor signatures mismatching

dark edge
#

It absolutely does work. Are you guys on the same editor version?

high current
#

yes

dark edge
#

How are you launching the game?

#

Ive even had PIE join a launched server just fine

high current
#

Interesting

#

was that launched server on another machine?

dark edge
#

Ya

#

Show the actual error you're getting

#

Also show how you're launching it.

high current
#

No error, sessions are not found and Open IP doesnt do anything

dark edge
#

Are you sure the hosting machine is actually hosting? How are you launching it?

limber mortar
#

@dark edge Yes it is 1 array per connection and no difference there. I was thinking if the function that spawns the fire is called thousands of time per game round, could some kind of performance or networking benefit be achieved by changing what actor referenced that array.

#

Which also might not matter, I'm pretty novice with unreal and self taught. So it could be a silly question

#

Just having a hard time making the quantity of fire particles I want to appear, appear at 60 fps, so want to make sure I am calling from the best places

dark edge
#

@limber mortar when in doubt, just think of what the minimal amount of information is required to be sent everywhere so the game stays in sync and you'll be good. For example, for a first person shooter, really all you need to network is everybody's position, velocity, and aim direction. Things like animation state are all derived from that

limber mortar
#

while also looking at the emitter itself

#

yea, thanks, that makes sense

#

following that logic I am going to test calling the fire particles on clients only

dark edge
#

@limber mortar so what exactly are you trying to do here? It seems kind of weird to have to replicate something like checkpoints thousands of times

limber mortar
#

I have a game where a wildfire burns across the world and threatens a town

#

choppers, engines, dozers, the physics get affected when my fps is too low

#

so I have fire particles spawning across the map

#

and 1 actor controls all the spawns

#

It takes each damaged area, and spreads the fire around via damage. Each damaged area has a location saved to an array, and each tick the actor will take newly damaged array locations and spawn an emitter

#

so once per tick this actor goes through a for loops of new locations and applies damage, and spawns a flame

#

Each fire 'cell' that spreads has a random timer to initiate the spread between 3-4.5 seconds

#

to prevent them all firing off at once

dark edge
#

@limber mortar how many cells in total do you have?

#

Like what's the resolution of your fire map

limber mortar
#

Let me check, the cells fire can spread into are built into the level

#

but the cells are not the actor that spawns the fire

#

505x757

dark edge
#

The cells are basically the base data the represents whether an area is on fire or not right?

limber mortar
#

yes

#

those little white balls represent a cell on the ground, it takes damage, adds its location to the array

#

then the controlling actor fires the damage around it and the particle generation

#

its not a big level

#

but I have 15-20k cells

#

I made a system to auto place them

#

the for loop itself doesn't seem to be an issue. If I disconnect the emitter spawn pin, then things run perfect

#

but hard to have a fire game without fire eh? ๐Ÿ˜„

#

So I am trying to do 2 things, Optimize my fire visual fx, and make sure all the networking of calling it right is best practice and correct

#

small fire such as this hits performance too much

#

gets worse when I add the smoke and black ground decal in hehe

high current
#

hmm so even on a packaged build we cant connect with open IP

#

our ports might be not configured with the VPN

#

but just to be safe is there like an example project out there provided by unreal that has the simple host/join sessions thing

dark edge
dark edge
high current
#

yep, company VPN, we'll check with IT about the ports

dark edge
#

First try it on one machine

#

Launch game twice and have 1 instance connect to the other