#multiplayer

1 messages Β· Page 493 of 1

thin stratus
#

uint16 Port = 27015 + (FCString::Atoi(*PortString) - 7777);
Do I need 27015 then or 7777? Cause 27015 is the port of steams query server and 7777 the game server.

#

And you seem to be incrementing and using 27015

twin kite
#

exactly you need to PingServer the query port

#

the game server port will be in the response

thin stratus
#

Alright, yeah I just need the damn id to connect to it

#

:D

twin kite
#

yea it was a pain in the ass for me too to figure out but thats the benefits of Steam's secure system

thin stratus
#

Yeah true

#

I know Epic didn't want to mix subsystems but they really didn't communicate that well enough

#

When I got the UniqueID mismatch error after updating to 4.22 I was a bit annoyed

twin kite
#

For PAX I was implementing a -lan command line argument which disabled Steam completely and used lan

thin stratus
#

would -nosteam not do that?

twin kite
#

not on shipping builds

thin stratus
#

sigh

#

Eh, what header has inet_addr

twin kite
#

"Winsock2.h"

#

make sure to wrap that code in #if PLATFORM_WINDOWS

#

also do you use Visual Assist X?

#

if not I'd highly suggest getting it

thin stratus
#

Yeah I do

#

Suggested a scrollable list of headers to add to fix this

#

So I rather asked :D

twin kite
#

yea

#

ue can be a bitch we had a problem with cooking mods for linux servers on a windows machine

#

the UAT needs the linux toolchain for staging which is stupid and not ideal for users using our editor

#

but we ship the editor on stock 4.20 so what I ended up doing was i ship a custom patched UAT with the mod editor and if you initiate a cook it will backup UE4's original UAT and patch in our custom one, cook with it, and after it copy the original one back as if nothing happened

#

feels super hacky but gets the job done

thin stratus
#

Yeah I doubt any modder will notice :P

twin kite
#

yea

#

alright gtg let me know whether it worked

thin stratus
#

Will do, thanks a ton!

rich ridge
#

Can anybody confirm that 4.23 generates the dedicated server build for Windows or Linux without any errors

#

I m having unknown error

steady dirge
#

@worn nymph I am trying to get my multiplayer working on a Linux Server (Strato). UE4.22 Visual Studio 2017. I am following the steps according to https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)#section_7_Building_and_deploying_a_UE4_dedicated_server_for_Linux . After coping the game and gameserver file to the server. I tried to start the server and got the following error : ./FluidDynamicsServer -log
./FluidDynamicsServer: error while loading shared libraries: libApexCommonPROFILE.so: cannot open shared object file: No such file or directory . Somebody a suggestion?

rich ridge
#

I m also following same guide

#

For me it's failing

steady dirge
#

I started with 4.23 and Visual Studio 2019. I also got all kind of errors. So I went to 4.22 and VS 2017. I made sure that VS 2019 was really uninstalled from my computer. Compiling went without a problem. Next phase is to get the project working on the linux server

rich ridge
#

@steady dirge means for you also 4.23 is not working

#

If you are building binary for dedicated server

steady dirge
#

@rich ridge I did not get it working, but I am not an expert. Maybe it also had to do with the fact that I had VS2017 and VS2019 installed?

thin stratus
#

I have 4.22 with 2019 and it works fine

#

So if there are errors, they come from 4.23

steady dirge
#

@thin stratus Did you also get your game working on a linux server?

thin stratus
#

Game is Windows

#

Server is Linux

steady dirge
#

@thin stratus So how did you get it working on the linux server?

thin stratus
#

Building the Server is kinda straight forward. Then I deploy it onto a docker container to make sure it runs fine in there and after that I just use an image of that container

#

That way it doesn't matter what the Linux Server has

steady dirge
#

@thin stratus Which docker container?

thin stratus
#

You don't need that. You can do it with the defualt docker stuff. Doens't need extra ue4 setups

steady dirge
#

@thin stratus I am looking around on the web. As I said docker is new for me. Is there e website I could look at

thin stratus
glad sedge
#

hmm I'm attaching an actor to another actor in a multiplayer game - I get weird behaviour sometimes where it's like the attachment is quite offset

steady dirge
#

@thin stratus Thanks, I will give it a try.

steady dirge
#

@thin stratus I am still trying to grasp the docker philosophy. If I am correct , I will build my Unreal project in the linux docker on my windows computer. So I download the Unreal Source and a Linux compiler in the docker, build the dedicated server in linux in the docker and next image the complete docker to my linux online server. So crosscompiling to linux in UE is not necessary?

shrewd frigate
#

Hello... This must be a very basic question. I am trying to implement facebook login with the online subsystem facebook. I already have a server that does the mapping after I get the facebook Id.

rich ridge
#

@steady dirge you got it wrong buddy,
What you need to is u can build your dedicated server and run it inside the docker so that u actually don't need to host on remote sever at least for testing. In this way u are saving some money that you can spend while you are promoting your game.

#

You connect your clients to the docker

steady dirge
#

@rich ridge Ok thanks. I am gona try, maybe I get the same error as before πŸ™‚

thin stratus
#

That's not what the docker is for either wtf

#

You are still paying hosting costs

#

You download UE4Source. You setup the Linux compilation stuff. You build your Linux Server. You setup a Docker image that represents what your final Linux should be (e.g. Ubuntu 18.4 or so).
You utilize Docker to copy over the DedicatedServer build to the docker container. You make an image out of this and now you have a self-contained system that you can just put onto whatever allows it and your server should 100% run.

#

As long as it runs in the docker container that you setup and you use that image in the future, you can be sure that it will work

#

We upload these docker images to PlayFab/Azure and they just run then

rich ridge
#

@thin stratus you mean I can't run docker on my local machine

thin stratus
#

Sure you can, but that's not what this is for

rich ridge
#

I can use docker on my local machine to t st

#

Test

thin stratus
#

You can also just put a Linux Machine up

#

And run it on there

#

If all you need is a server running

#

Well, the testing part of the docker container is part of the process

rich ridge
#

I said for testing purposes you can use docker locally

thin stratus
#

But yes you could also use it to just test locally in general

#

But that's also achievable with a lot of other systems

#

e.g. VMachine or just a laptop with linux

rich ridge
#

Let docker scale locally

glad sedge
#

you guys ever look at your project and think

#

fuck.

rich ridge
#

@glad sedge what do u mean?

glad sedge
#

Ah, just general chit chat.

thin stratus
glad sedge
#

I've learned a bunch of stuff about multi about mid-way through my project.

#

Well, I do have a question of sorts related to Multi

#

I seem to have an issue with projectile component and the speed at which it overlaps a character's sphere to initiate a 'snap to component' function.

#

But sometimes I get this weird offset and I'm having trouble finding what it could be, multi-wise. In my case I have sports game, so the ball is spawned and owned by the GameState, and its movement and itself is replicated. So I'm not sure how attach-to works with regards to an actor being attached - I imagine it's just replicating the movement, but if it's attached to a pawn - how does that work?

rose egret
#

how do I show a loaing screen during connecting to the server for the first time?

steady dirge
#

@thin stratus @rich ridge So the most important benefit of a docker is that if my UE dedicated server works on my linux docker on my local windows computer, it will also work on the server in the cloud. Thus the docker also takes care of the ports. Because that also can be an issue.

thin stratus
#

docker*

steady dirge
#

@thin stratus Changed it 😦

thin stratus
#

Ports probably not

#

As that is the router that sits between you server and the outer world

#

But yes, the rest is basically the idea of a docker container/image

glad sedge
#

Update: looks to be my bone was causing some issues (maybe related to WeldSimulatedBodies?)

steady dirge
#

So I installed docker, made an ubuntu image added my compiled unreal files (game and gameserver) Try to run , but still got the same error : ./FluidDynamicsServer: error while loading shared libraries: libApexCommonPROFILE.so: cannot open shared object file: No such file or directory

fleet raven
#

well does libApexCommonPROFILE.so exist where it should be?

steady dirge
#

I found a forum discussion om a similar problem. The suggested answer was that it should be included in the package, I think I did so? The result of the packeging is 1 big exe file

#

According to the guide after compiling the server and game there a 2 files Game.exe and GameServer.exe. All the lib should be included?

thin stratus
#

You are building for Linux, right?

#

Cause Linux has no .exe files

steady dirge
#

Yes for linux and yes both are files without .exe

thin stratus
#

Yeah the game one you don't need

#

Only the Server one

#

You should also look into using UnrealFrontend to build and package your Server

#

You should have these files in your main server folder

steady dirge
#

In the the tutorial You needed both Game and GameServer

thin stratus
#

Then the tutorial is wrong

#

Game is only needed for the Client

#

If you use the UnrealFrontend, step 2 and 3 will besically be one button press

#

And it will also only generate the server

#

You can find the Frontend either in the editor

#

Or in the Source Engines Binary folder

steady dirge
#

Thanks I am going to look into UnrealFrontend

steady dirge
#

When I start UnrealFrontEnd, it has to do with compiling for other devices. There is no linux there?

#

I found the Add An Unlisted Device. I can add a Linuxserver. Looks all very complicated. I hoop there is some proper documentation

#

Most video's on Youtube discuss Frontend in UDK? <2013 Old

gray scroll
#

Can you do saemless travel to lobby after game? It works for server but not for clients 😦

#

i m running my current event on server

winged badger
#

you can

#

as long as lobby is on same game instance

#

as in same instance of the game on the same machine

#

just to cover checkboxes, i can imagine a scenario where your lobby and play GameModes aren't the same

#

and you forgot to check seamless travel on the play GM

#

@gray scroll

gray scroll
#

@winged badger but for server... they can servertravel without the lobby and gamemode being the same?

#

Because the server is able to travel

#

but just not client

winged badger
#

if server starts seamless travel clients get pulled with it

gray scroll
#

i have a server event that runs that calls another server event that runs servertravel on each player controlleer @winged badger

#

but client is not moving to the other map... just server

winged badger
#

that isn't how you typically do seamless travel

#

seamless will call the travel on each PC under the hood

gray scroll
#

@winged badger

winged badger
#

that is hard travel

gray scroll
#

maybe you are thinking in cpp... in BP... i can only do it via console command

#

oh then what should i be doing

winged badger
#

run the console command

gray scroll
#

isnt that what i m doing?

#

@winged badger should i do it without specified player?

winged badger
#

thats a listen server?

gray scroll
#

yes

winged badger
#

ServerTravel <LevelName>?listen on host's PC only

#

with boolean for seamless ticked in GM

gray scroll
#

let me try

#

@winged badger worked! Thank you!

craggy oxide
#

Should connecting Android and PC in the same LAN via the session nodes work by default? Or would that require a special setup? In this particular case I want Oculus Go/Quest devices to connected with a Vive on PC.

clear salmon
#

What is the C++ equivalent of Event AnyDamage?

fiery geyser
#

@clear salmon OnTakeAnyDamage

clear salmon
#

i assume i need to bind a function to that delegate

winged badger
#

that is a delegate

clear salmon
#

eh well sorry, im setting it up for multiplayer πŸ˜„ considering it is a Server Side Event right

thin stratus
#

@craggy oxide Technically, if both use SubsystemNULL, it should work.

craggy oxide
#

Thanks a lot for your reply, @thin stratus ! Thought that not having the Oculus SDK installed on the PC but using it on the APK might be the issue.

ivory portal
#

Guys, I have a very weird problem. I have a multicast node. When my dedicated server and TWO clients are connected everything works fine. When I have three clients connected and he multicasts the multicast doesn't happen AND the whole server crashes for UnknownFunction errors?

#

anyone else noticed this problem as well?

ivory portal
#

It has something to do with the actor set to replicate or not while debugging further

#

I've changed the multicast event to a gamestate with onrep and fixed the problem

#

still weird

thin stratus
#

Where did you call the multicast

#

And what was is set to

ivory portal
#

GameMode multicast to two actors in level

#

So something in those actors would change

thin stratus
#

So the Multicast is in the Actors?

#

@ivory portal

flint plaza
#

This works to host a multiplayer session in editor and opens the specified map

#

but when I package and run this on Android, nothing happens

#

Is there a different way to create and join sessions in Android

royal isle
#

Hey, is root motion only supported by ACharacter children?

tawny rivet
#

all documentation seems to refer to root motion as being a feature of characters

#

but nowhere specifically says it is br_thinking

stoic ore
#

if you look in ACharacter.h you can see how it's implemented and copy that to other classes. I think there is unfortunately no Interface or class which handles this by itself

#

#include "GameFramework/RootMotionSource.h" maybe you will look here for rootmotion

royal isle
#

ye I feared as much, ty

worthy perch
#

Is there anything special to netprofiling on a Steam listen server?
My log gets flooded with this LogOnline: Warning: STEAM: FInternetAddrSteam::GetIp is not supported and will set OutAddr to 0..
I am not on a shipping build with UE 4.21, if that's relevant.

wintry dock
#

Anyone else having problems finding sessions using Steam Advanced Sessions?

twin juniper
meager spade
#

?

wintry dock
#

Hm, whenever "Find Sessions Advanced" is called it immediately fails. I can Shift-Tab and my name in the game is my steam name

thin stratus
#

@worthy perch Well Steam doesn't support ip addresses like this.

#

@twin juniper it's blue cause you are casting PlayerController to PlayerController.

worthy perch
#

Alright. I was more so wondering if anyone else has run into this issue while trying to netprofile.
Strangely, I seem to be the only one who has this warning.
I don't think this warning ruins the netprofile, but it's definitely annoying in the logs.
Unless there's another way to profile.

lost inlet
#

well it does if you disable p2p sockets

ivory portal
#

@thin stratus yes, I think it went wrong at some point with too much data or something

flint plaza
#

Can anyone answer my question posted 15 hours ago?

thin stratus
#

What subsystem have you set up?

#

Does Android/Google implement the session stuff?

flint plaza
#

Null

thin stratus
#

And you are in the same LAN?

flint plaza
#

I don't know. I am new to Android via Unreal

#

yes

thin stratus
#

Does the Session create or not even that?

#

Do you connect to a PC, from a PC or both Phones?

flint plaza
#

not even that.
I connect 2 phones

#

phone doesn't host session successfully

thin stratus
#

Logs?

flint plaza
#

How can I get logs? via adb?

thin stratus
#

Not 100% sure, but you can ask in #mobile

flint plaza
#

okay.
I also heard that there was this bug in 4.21 and 4.20. So i just installed 4.23 now. Let's see if that works

flint plaza
#

GameSession Already exists

thin stratus
#

Yeah that happens if you try to create it more than once.

#

Or if you didn't properly destroy it.

#

Soooooooo DedicatedServer + Steam, right? Our most beloved topic here. What is up with the #defines in the AsyncServerSteam cpp?

  1. Aren't they exposed now to the build.cs or Target.cs file?
  2. Are they still too long so you they have to be redefined to not cause an overflow?
#

Oh what

#

They made them even longer?!

#

#define UE4_PROJECT_STEAMGAMEDIR STEAMGAMEDIR

#

.>

#

Actually not sure if that was the overflow then

flint plaza
#

Is "not able to locate the map" the problem here or is it something else?

thin stratus
#

Well you are using GOOGLEPLAY as Subsystem in that screenshot

#

GooglePlay has no Session Interface

flint plaza
#

I have Null specified in the DefaultEngine.ini

#

Must be defaulting to it idk

thin stratus
#

The other thing is the map missing I guess

#

Not sure how you package and how everything is setup

flint plaza
#

I thought everything in the Content folder is cooked unless you specifically exempt it

lapis breach
#

i think there is a option to not cook non referenced assets

craggy oxide
#

Still trying to figure out why cross-platform local multiplayer isn't working: PC and Android (Oculus Go) can both host and find the other platform's game. Android can connect to PC, the map will load/travel just fine. PC cannot join Android. Android cannot join Android. Travel doesn't seem to happen in most of the configurations. :/ Any ideas maybe?

plain lagoon
#

is it a heavy scene? @craggy oxide

#

oculus go cant handle too much

craggy oxide
#

It's a rather simple VR game. What would make it a heavy scene?

plain lagoon
#

depends how many quads/polygons

#

iirc oculus go can handle up to 300k poly scene

craggy oxide
#

So a quad overdraw could lead to the system not being able to join another in multiplayer, even when they can do singleplayer just fine?

plain lagoon
#

if it works in singleplayer just fine it shouldnt be a problem

craggy oxide
#

We had it working over online multiplayer at some point, but wifi, voice and gameplay make it hard to really play it via online service, due to the lag

#

It's rather frustrating that the games work solo, host can be found in network, but joining/traveling just doesn't work. Tried opening the map with ?listen, as well as staying on a lobby map, to then do a ServerTravel, after a client joined the host. Neither seems to be working as expected.

twin minnow
#

does anyone know what the difference is between BeginPlay and StartPlay in AGameModeBase?

fleet raven
#

startplay calls beginplay on all actors (including the game mode itself)

twin minnow
#

oh ok i see

#

what triggers a call to startplay then?

modern swift
#

void UReplicationGraph::RemoveConnectionGraphNode(UReplicationGraphNode* GraphNode, UNetReplicationGraphConnection* ConnectionManager)
{
ConnectionManager->RemoveConnectionGraphNode(GraphNode);
} // anyone know why use removeconnectionGraphnode will also kill the playercontroller?

vapid egret
#

Can a dedicated server handle more than 1,000 simultaneous players?

winged badger
#

no

#

even high budget games like Fortnite and PUBG are struggling with 100

unique thunder
#

@vapid egret It's not impossible but you probably don't own the hardware to do it and it's too expensive to pay a thirdparty to host it

winged badger
#

for a single dedi? it is impossible

unique thunder
#

no, split

winged badger
#

only way you can do it is splitting the load

vapid egret
#

What if I make a network, can unreal connect tcp and udp connections without problems?

unique thunder
#

I've only done ded with AWS, not sure about native UE networking, Zlo might know

winged badger
#

SpatialOS is a middleware that uses unreal networking and allows for distributing the load over several servers

thin stratus
#

Anyone up for some Linux Steam DedicatedServer debugging?

#
[2019.09.26-16.19.05:419][  0]LogOnline: Verbose: OSS: Creating online subsystem instance for: Steam
[2019.09.26-16.19.05:419][  0]LogOnline: Verbose: STEAM: Initializing Steam Game Server IP: 0x00000000 Port: 7777 SteamPort: 7778 QueryPort: 27015
[S_API FAIL] SteamAPI_Init() failed; SteamAPI_IsSteamRunning() failed.
dlopen failed trying to load:
steamclient.so
with error:
steamclient.so: cannot open shared object file: No such file or directory
[S_API FAIL] SteamAPI_Init() failed; unable to locate a running instance of Steam, or a local steamclient.so.
[2019.09.26-16.19.05:419][  0]LogOnline: STEAM: [AppId: 0] Game Server API initialized 0
[2019.09.26-16.19.05:419][  0]LogOnline: Warning: STEAM: Failed to initialize Steam, this could be due to a Steam server and client running on the same machine. Try running with -NOSTEAM on the cmdline to disable.
[2019.09.26-16.19.05:419][  0]LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
[2019.09.26-16.19.05:420][  0]LogOnline: Warning: STEAM: Steam API failed to initialize!
[2019.09.26-16.19.05:420][  0]LogOnline: Display: STEAM: OnlineSubsystemSteam::Shutdown()
#

Checking for steamclient.so tells me "You shouldn't even need that for a gameserver."

#

Sooooo this should just be normal ue4 code

#

It falls back to using IpNetDriver, so I can't ignore this I guess

#

Well it says no such file

#

There is also "No such file", as this is not a steam client

thin stratus
#

But the docker has connection issues to steam even though I should be openeing ports properly, but well

lapis birch
#

Hey guys, I'm having some trouble setting up a dedicated server for our project. as outlined in this guide: https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)

I've followed the instructions and I have a dedicated server running on UE 4.23.1 like so:

but it doesn't seem to actually listen on port 7777, or even load a map. I can't join it. I've repeated the build process many times and beyond it not listening on port 7777, there doesn't seem to be much else going on. Logs don't say anything beyond what you see in the screenshot.

Building a server with a blank third-person project does work, which tells me it's specific to our project. Does anyone have any ideas?

twin juniper
#

Hey

#

Does anyone know if you can connect to ip address using advance sessions plugin

thin stratus
#

You can connect via ip without it

twin juniper
#

with open (ip) ?

#

Also why is my char not moving or accepting any inputs in Multiplayer

bitter oriole
#

Yes, open <ip>

thin stratus
#

Cause you mostl ikely did something wrong

#

We have no idea what

#

It's like me asking you why my microwave isn't working

#

(it does work)

twin juniper
thin stratus
#

Anyway, my Linux DedicatedServer doesn't show up in lists but allows steamp2p address connections

#

So I guess that's fine /shrug

twin juniper
#

And that is default

thin stratus
#

Is that with steam?

twin juniper
#

Non steam

thin stratus
#

Yeah idk, make sure the input mode is Game

#

And that you actually possess stuff

twin juniper
thin stratus
#

Can only guess

bitter oriole
#

Multiplayer movement is immensely complicated, so take it step by step

#

Check that RPCs fire, check who's possessing the pawn, debug everything

#

In any case, Steam is not related to this

twin juniper
#

All i getg

#

im in a dedicated server

#

even lan server does that

bitter oriole
#

Did you try with multiplayer in editor first ?

twin juniper
#

no

#

Using IceVillage?lisen

bitter oriole
#

So start there

#

Open the editor, and just play with two players first

#

Dedicated is much harder to get running

twin juniper
#

Does not work

#

With open IceVIllage?listen

bitter oriole
#

So forget about that, and go back to the basics

#

Editor, two players, no "open" or Steam or dedicated

twin juniper
#

Wdym

bitter oriole
#

Yes, that

twin juniper
#

its loading

bitter oriole
#

Hit play, and get your code to work there

twin juniper
bitter oriole
#

Did you make sure to hit "play", not "launch" ?

twin juniper
#

i did

#

the other client is connecting to something

#

It failed

#

This one i see map but cant move

bitter oriole
#

Well, disable whatever in your game code is trying to connect to stuff

#

This is a "your game" problem - a new project does not do anything like that

twin juniper
#

could it be character BP

bitter oriole
#

it could be anything, but I can't help you, since I don't know anything about your project

twin juniper
#

version v100 worked fine

#

just couldent package version v100

bitter oriole
#

What's v100 ?

twin juniper
#

Cause version kept saying unkown error

bitter oriole
#

Look, I've no idea what you're doing here

twin juniper
#

That one has multiplayer working

bitter oriole
#

That one ? What ? Your game ?

twin juniper
#

yeah

bitter oriole
#

Okay ? So all is well ?

twin juniper
#

yap

#

but it doesnt build

#

because of unkown error

bitter oriole
#

So fix the error

twin juniper
#

I tried remaking all blueprints

#

i think its an engine issue

#

but the multiplayer works

bitter oriole
#

It's not an engine issue

#

Read the log, and fix the errors

twin juniper
#

ok

bitter oriole
#

If the packaging fails, put the log on pastebin and share it on #packaging

twin juniper
#

where are logs located

#

for build

bitter oriole
#

You are reading it right now

#

It's in your screenshot right there

twin juniper
#

im reading it yap

bitter oriole
#

The full log

twin juniper
#

alternatives

bitter oriole
twin juniper
#

πŸ˜‚

bitter oriole
#

Clear the log and restart the packaging so that you have only the last one, or only put the end of it

twin juniper
#

try this

#

i cut it down

bitter oriole
#

Lots of error in there

#

LogBlueprint: Error: ProxyFactoryClass null in K2Node_LatentOnlineCall /Game/Blueprints/Multiplayer/ExampleBlueprints/ExampleAdvancedSessionsFunctionsChar.ExampleAdvancedSessionsFunctionsChar:EventGraph.K2Node_LatentOnlineCall_31. Was a class deleted or saved on a non promoted build?

#

This ExampleAdvancedSessionsFunctionsChar Blueprint is broken

#

[DragonAnimationCharBP] ANIM_MOUNTAIN_DRAGON_death to ANIM_MOUNTAIN_DRAGON_idleLookAround will never be taken, please connect something to Can Enter Transition

#

And finally, master_vine_spline_C has materiual problems

#

Failure - 2 error(s), 6551 warning(s)

#

Still think it's an engine bug ?

twin juniper
#

MenuCaroussel

#

was the problem

#

in v200

bitter oriole
#

Now it's ExampleAdvancedSessionsFunctionsChar, DragonAnimationCharBP and master_vine_spline_C

#

Fix these and you'll be fine

twin juniper
#

i did

#

and i still get issue

#

but its that asset

#

il have to find a way to fix it

twin juniper
#

Problem fixed

#

evreything works

#

it was a depresed option

#

(A option which wasent supported by ue4 anymore)

outer wolf
#

Hey guys quick question. If I declare a NetMulticast on an actor, and call that NetMulticast from the server on the actor, will the function only be called on clients that are relevant to that actor? Or is it server wide?

winged badger
#

there is no actor on client if its not relevant

twin minnow
#

@outer wolf it depends, is the actor to set to replicate? If so then the netmulticast function should be called on all relevant clients. However, there has been debate around the forums where people point out that the netmulticast function in this case would get called on all clients regardless of relevancy. You can see these discussions here, https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1501818-need-some-clarification-on-netmulticast-events-and-actor-relevancy. And here, https://forums.unrealengine.com/unreal-engine/feedback-for-epic/1511578-improvement-of-netmulticast-to-save-performance-and-bandwith-on-nonrelevant-actors. Of course if the actor only exists on the server, then the function will only get called on the server.

#

@fleet raven sorry to bother u, but do u know what triggers the StartPlay function in AGameModeBase to get called?

winged badger
#

@twin minnow how hard is it really to find the function in the source code and search references?

twin juniper
#

Some pepole are playing on it

twin minnow
#

fair enough, I should have done that before asking. It seems to go UWorld::BeginPlay() -> AGameModeBase::StartPlay() -> BeginPlay() for all the actors

vagrant hemlock
#

Just for testing purpose i only add walk forward animation to final animation node server side everything is good but client has foot sliding can anyone help me

random coral
#

Hey guys. Just read the documentation of the CharacterMovementComponent and saw that MovementTimeDiscrepancyDetection is disabled by default. But why? Are there any disadvantages using the detection and resolution of time discrepancy?

echo geode
#

Can someone identify that what is Presence on Online Subsystem?

bitter oriole
echo geode
#

@bitter oriole Thanks. Got it.

random coral
#

Does Unreal also use tcp for networking or only udp? Are reliable RPCs send via tcp and unreliable RPCs via udp?

bitter oriole
#

IIRC it's UDP for both with TCP-like logic reimplemented on top for Reliable RPCs

#

It doesn't matter tbh

#

Reliable behaves like TCP, Unreliable behaves like UDP

random coral
#

K, thx

twin sable
#

and that makes perfect sense if you can predict stuff, like if you say "by 55 seconds ingame the building will be constructed", then the clients can interpolate the rest of the construction. however if you are sending position data, that you cant predict the future of, the client will have to interpolate this information with an added delay

#

but I cant think of a delay method that wont break due to a higher ping. like if I have a set 250ms delay,that would mean anyone with 250+ ping the interpolation would no longer function

thin stratus
#

Shouldn't "IsDedicatedServer" work in PIE too? o.o

#

So you can't do "GetNetMode()" in gamemode

#

YOu have to do GetWorld()->GetNetMode for it work in PIE

#

sigh

real yacht
#

Is it possible to create Character (with CharacterMovementComponent) and replace mesh to be something else, for example car, airplane, ship... Can we assume that interpolation and prediction should work?

thin stratus
#

Yes but keep in mind the capsule is locked

#

It's meant for humanoid shapes

real yacht
#

yep

scenic raven
#

Hello everyone, I have a snippet of code that makes sense to me but apparently not to Unreal, as the netmulticast is never being called on other clients (other than the one originating the first server call). Any clue?

void AVVPlayerController::Ping()
{
    UWorld* World = GetWorld();
    if (!World)
    {
        return;
    }

    if ((PingActor) && (!PingActor->IsPendingKill()))
    {
        return;
    }

    FHitResult HitResult;

    if (GetHitResultUnderCursorByChannelIgnoringSelf(UEngineTypes::ConvertToTraceType(ECC_GroundTargeting), OUT HitResult))
    {
        Server_Ping(this, HitResult.Location);
    }
}

bool AVVPlayerController::Server_Ping_Validate(AVVPlayerController* PingOwner, const FVector WorldPosition)
{
    return true;
}

void AVVPlayerController::Server_Ping_Implementation(AVVPlayerController* PingOwner, const FVector WorldPosition)
{
    UWorld* World = GetWorld();
    if (!World)
    {
        return;
    }

    Multicast_Ping(WorldPosition);
}

void AVVPlayerController::Multicast_Ping_Implementation(const FVector WorldPosition)
{
    UWorld* World = GetWorld();
    if (!World || World->IsServer())
    {
        return;
    }

    PingActor = World->SpawnActor(PingActorClass, &WorldPosition, &FRotator::ZeroRotator);
}```
winged badger
#

that kinda looks like it would run only once

scenic raven
#

the actor dies on its own after a while

thin stratus
#

Well

#

You are aware that this PlayerController

#

Does indeed not exist on any other client

scenic raven
#

oh shit

#

you're right

#

when I do the netmulticast

#

it tries to do it on itself

#

not A player controller

#

on the clients 😭

winged badger
#

hey, since what version doesn't that immediately boot clients out?

thin stratus
#

It boots clients out if you mark it reliable iirc

scenic raven
#

it is marked as reliable

thin stratus
#

Then they fixed that

winged badger
#

the boot was there in 4.18

#

wasn't at 4.22

thin stratus
#

I had the same issue @winged badger. I had a component that could sit on multiple classes, one being the PC.
A multicast was to update everyone (inventory UI). On PCs it caused the booting.

winged badger
#

along with replicating TMap not crashing anymore, just spamming warnings

thin stratus
#

TMap replication. Hope will never die.

winged badger
#

its not that hard to do it by hand

thin stratus
#

Depends on the stuff in the TMap

winged badger
#

gets repetative fast tho

#

i mean for a specific TMap that you need to replicate

thin stratus
#

We had it working with non-actor pointers.

#

But with it was starting to break.

winged badger
#

its easy to do it by hand, generic way not so much

thin stratus
#

It was a simple Struct of 2 TArrays

#

With Keys and Values generated.

#

Probl was iirc, that the values had a struct again and in there a Tarray of actors.

#

The size replicated fine, the Tarrays of actors broke

#

Epic's response, nesting that stuff is not really supported.

#

So you can do the TMap replication via 2 arrays, but it really depends on what shite you are having in the arrays

winged badger
#

worst case, you can actually write a NetSerialize yourself

thin stratus
#

It all goes down to being two arrays again though

winged badger
#

at least there are some excellent examples in the engine

thin stratus
#

Keys and Values

winged badger
#

yeah, but it can "unnest" the nested stuff for serialization

#

if done by hand

thin stratus
#

Right, it's also a special case

#

I think it's

TArray<FStructA>
And StructA having a TArray<AActor*>

#

And that TArray<FStructA> is the Values array.

#

And replicating that gives the right sizes for the inner TArray<AActor*>

#

But the values are broken af.

#

If the first Array has e.g. 3 entries, all 3 entries are valid.
All following Arrays have up to 3 valid entries.

#

So if you have e.g. Two arrays in the FStructA, first having 3 entries and second having 5 entries.
After the replication the client has the first entry totally fine and teh second with size 5 but only 3 valid entries.

#

Total shitshow

winged badger
#

ouch

thin stratus
#

All 8 Actors in this example are replicating fine and available

#

It always depends on how many entries the FIRST array in the struct has.

#

Has it 0 entries, all following actor arrays will have the correct size but not a single valid entry.

#

And yeah, "ouch" is a good reaction to that :D

winged badger
#

bool FHitResult::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)

#

excellent example of NetSerialize in engine, btw

#

you could theoretically pack all AActor* arrays into a single one, then serialize an int32(length) for each struct instead of the array

#

(that is beyond the point what i'd consider elegant code)

thin stratus
#

But that's where the fun begins :D

twin minnow
#

does anyone know where the UniqueId variable in AGameModeBase::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage) comes from? For example, when a player connects to the server I currently call OpenLevel, so I know I can pass options to that method call. However, do I pass in a uniqueid through that method as well? Or do I set the UniqueId in PlayerState before connecting to the server?

thin stratus
#

That stuff usually comes from the underlying subsystem

twin minnow
#

so this uniqueid shouldn't be manually set?

thin stratus
#

Usually not, no

twin minnow
#

ok gotcha. I was just wondering because I have to assign a unique player session id for aws gamelift and wanted to know if I should use this UniqueId parameter or just make a new property for it.

thin stratus
#

No, you need to keep that the same type as your client is

#

Otherwise you will be outright kicked from the server on connection

#

So whatever Subsystem your client uses, the server has to use the same

twin minnow
#

so does the UniqueId in PreLogin correspond to the one in PlayerState before and after calling openlevel?

thin stratus
#

Technically it corresponds to the ID it has all along

#

afaik the ID is passed on connection

#

Your PlayerSessionID has to be passed via the options

#

Not via the unique id

twin minnow
#

oh ok i see this is what I do now, passing a playersessionid via the options.

#

would it be bad practice to use the unique id as the player session id for aws gamelift?

thin stratus
#

I just said you shouldn't touch it :D

#

GameLift has nothing to do with your Subsystem

#

The ID should be stored and passed additionaly

twin minnow
#

alright, thank u for dealing with my ignorance

thin stratus
#

Also are you using Steam on the Client?

twin minnow
#

not currently, but eventually yes

thin stratus
#

Then be ware of the fact that UE4 will force you to have Steam on the Server too

#

And Steam doesn't do IP connections

#

So you will have to get the steamID of the Server from the IP you get from Gamelift

#
  • Crossplatform would require you to setup your own subsystem to get a uniqueID that is shared across all devices
#

In case you ever want to go the way of Xbox etc.

twin minnow
#

thank u for the heads up, will definitely keep this in mind

twin juniper
#

Does anyone know why advanced sessions give you a username you dont want

#

i set Username but it keeps changing it!!!

#

Arggg

thin stratus
#

Advanced Sessions doesn't have anything to do with the Usernames afaik

#

You can set a ServerName

#

Not sure if they allow passing any other data along

fleet raven
#

the default/null subsystem uses the computer name of the client as the user name, it's extremely dumb

twin juniper
#

That works

thin stratus
#

Yeah cause you actively set the name

twin juniper
#

do i need to set it after server is run

#

or i can set it before?

thin stratus
#

Well depends on where the name comes from

#

Is it from the client?`

twin juniper
#

Yes

thin stratus
#

Or from some backend?

twin juniper
#

Tek Plus Network API => Client => UI name

thin stratus
#

If it's from the client, then you need to tap into the ClientTravel function iirc and pass ?name=Dragon Test

twin juniper
#

ClientTravel function?

thin stratus
#

Usually ClientTravel is called when you use the JoinSession function

twin juniper
#

Ok

thin stratus
#

Once the Session is joined, the client travels to it

#

So you'd need to adjust that

#

Since you have the source of the advanced session plugin you can easily do that

#

Be aware that Multiplayer dev will force you into c++ eventually

twin juniper
#

So do i scrap my blueprint project

#

And give up and make C++?

thin stratus
#

No one said that

twin juniper
#

or i can use C++ in the blueprint

thin stratus
#

You can but not for this

#

You have to edit the plugin source you have from the advanced session plugin

#

To pass the name with it on connection

twin juniper
#

how can i edit the plugin?

#

From my project

thin stratus
#

You have to turn your project into a c++ one

#

Then you can see the source of the plugin too

twin juniper
#

How do you convert it?

thin stratus
#

By adding at least one c++ class via the editor

#

mind there is no way back to a BP only project after that

#

at least afaik

#

So make sure to push all changes to your source control first

twin juniper
#

Im scared of using C++

#

its been years

#

since ived used it

thin stratus
#

Welp, you are deving a multiplayer game

#

Blueprints won't cut it

twin juniper
#

Failed

thin stratus
#

Just close the editor, remove your intermediate folder , rightclick the uproject file and hit "generator visual studio project files"

#

That should give you a fresh intermediate folder

#

and an .sln file if you don't have any already

#

If you open that you can access your new class and under plugins in the solution browser also the plugin source

twin juniper
#

alright

#

Will all my blueprints be moved to C++ classes

thin stratus
#

Once you did your changes you can rightclick the project in the solution view and hit build

#

Once that build you can open your editor again

#

No, they won't

twin juniper
#

so it breaks the entire game?

thin stratus
#

-_- no it doesn't

twin juniper
#

okay

#

i trust you πŸ™‚

#

hopefully my beta testers wont be like what happend?

#

alright it has a sln file

thin stratus
#

Open the sln file

#

not the project

twin juniper
#

this?

thin stratus
#

That's the source of the plugin, yes

#

Actually

#

It's engine level

#

Why do you have that on engine level

twin juniper
#

idk

thin stratus
#

Uff

twin juniper
#

plugin folder in my project?

thin stratus
#

Yeah you would need to move it from the engine to the Plugins folder of your project

#

Then you have to regenerate the project files again (intermediate folder can stay this time)

twin juniper
#

Ok

#

do i remove it from the engine

thin stratus
#

Would be recommended

twin juniper
#

alrighty

#

I hope i can still use blueprints

#

they are fun πŸ˜›

#

Alright so now i need to find the class to edit

#

I found it

thin stratus
#

That's the wrong class though

#

You need to modify the one that joins the session

#

So you can pass the name along

twin juniper
#

ok

vagrant hemlock
#

I have been making a Dark Souls like combat system and when I set the Root Motion in the Anim BP to Root Motion From Everything it causes all clients to play animations very quick while the sever plays at the right speed. I can't figure out what is causing this

twin juniper
#

Where did they put that Join session

#

!?!?!

thin stratus
#

Might be called something like "JoinAdvancedSessionCallbackProxy" or so

twin juniper
#

none of that

vagrant hemlock
#

@thin stratus buddy can you help me with my problem

twin juniper
#

I see update session

#

but not join

#

Find session

#

And create

thin stratus
#

Are they actually providing a custom node for joining?

twin juniper
#

I think its get session

thin stratus
#

Well you are using it

#

It most likely has a similar name

#

These nodes are based on the class

#

They are used to create latent nodes

#

So nodes that call back later in time

#

So every one of these Join,Create,FindSession nodes

#

are each one class with something like JoinSessionCallback

#

The engine has default ones

#

so they most likely are named JoinAdvancedSessionCallbackProxy or something like that

thin stratus
#

How are you currently joining the session

twin juniper
#

Join Session

thin stratus
#

And that's the standard node?

twin juniper
#

Yes

thin stratus
#

Welp

#

Could have told me that :D

twin juniper
#

Maybe i can try it with Create session

#

for client hosted

#

Like client hosts its own server

#

well it needs its player name

thin stratus
#

That doesn't give you the ability to get the name from the clients

#

So one thing you should do now

#

Is rightclick your project name in the solution windwo of vs

#

and hit build

#

And wait for it to complete

#

so you can get back to working in blueprints for now

#

I would say you rather workaround this by storing the playername in either a savegame or the gameinstance of the individual client

#

And after they connected (PostLogin in GameMode)

#

You send a ClientRPC

#

The client RPC gets the name from savegame or GI

#

And then sends a Server RPC back

#

can all be done inside the PlayerController class

#

That is a work around, an ugly one though

twin juniper
#

or save the unique client id

#

with a token from the launcher

#

and get the player name from the Tek Plus Network Database

#

aka MySQL

thin stratus
#

I literally asked you if the name comes from a backend

twin juniper
#

my names come from Mysql

#

from that thing

thin stratus
#

Then the Server should use the unique id of a connecting player

twin juniper
#

Its a public server

thin stratus
#

to retrieve the name from the db

twin juniper
#

so sharing address is fine

#

Yeah

#

sweet it worked

#

so basicly i can mix C++ and Blueprints?

thin stratus
#

Yeah, you can leave the sln file alone if you don't do any c++

#

Well yeah

#

Blueprints are C++ Child Classes

twin juniper
#

I want my game to be based like ARK

#

a little.

thin stratus
#

Low FPS and terribly optimized? kappa

twin juniper
#

No

#

WIthout that

#

My game is pretty well optimized rn

#

I try to stay away from loops and too many meshes

bitter oriole
#

Too many meshes, that usual performance problem

twin juniper
#

something is clearly not working

#

Thats weird

#

i think its a replication issue irght

twin juniper
#

Hi, i was wondering, if we have different players in the same game are they all going to be the thirdpersonCharacter?

twin juniper
#

Something gliched

#

sorry

#

Discord presence

twin juniper
#

Hey does anyone know if you find servers outside the network with advanced session plugin?

fierce birch
glad sedge
#

Hmm in an online sports game, like NFL, would you make the ball an actor - or would you potentially just set the location of it via the server and then update the client's version of an actor?

random coral
#

Hey guys. Just read the documentation of the CharacterMovementComponent and saw that MovementTimeDiscrepancyDetection is disabled by default. But why? Are there any disadvantages using the detection and resolution of time discrepancy?

fleet raven
#

it's somewhat broken and can result in false positives

covert gorge
#

Has anyone managed to advertise (internet tab) a steam dedicated server using advanced sessions plugin in 4.22.3?

thin stratus
high current
#

What are things that you needed to implement on every multiplayer project, regardless of the actual game. I am compiling a list for me and the programmers to start looking into and setting up the next 4 weeks, while the game concept is being created?

thin stratus
#
  • A menu to handle sessions.
  • Custom Session Nodes (or just functions).
#

And that's pretty much it on "every" project

#

Rest seems to be depending on the project

high current
#

What do you mean by custom session nodes, for connecting outside steam and things like that?

#

We know a few things about the project already, we will be using steam, we wont be doing dedicated servers, we need some kind of matchmaking, local split screen play, drop in drop out system (meaning you cant really play offline and every match is a listen one) and we have to make sure the game runs on ps4, altho we don't have networking license for that, so just running it locally with split screen

#

oh and we probably need to look into host migration

thin stratus
#

So you basically want to use a different engine :D

#

Well at least if you need the host migration

#

Cause that's pretty much never done if even possible

high current
#

Haha, ok then I guess we wont be looking into host migration

#

if you use the replay system, wouldn't it be possible to host again, and restore stuff based on the data from that recording?

#

But yeah, that is another topic. I also planned to look into proper keybinds support, that isn't MP related but still has to be done for every project

thin stratus
#

UI for Splitscreen is a nightmare

#

Specially with Controller support

#

Be prepared to create a lot of custom widgets that just wrap existing ones

high current
#

iirc you had to use add to player screen, instead of viewport

#

We also have to support dynamic split screen like in A way out, so it will be even trickier with anchors and stuff, so I guess I should try test some UI stuff

#

Any other generic stuff come to mind? Might not even be MP related

#

Oh, since we will be doing networking, and the gameplay will be done in BP mainly + the replication, what kind of stuff would you recommend that is exposed from C++ to BP, replication wise

thin stratus
#

Uff, that's really hard to answer

#

You will just have to encounter the blocking stones yourself

#

Idk what stuff you could run into

high current
#

I already have noted the OnRep thing, where C++ allows you to receive a notify even if it is the same as the last update

thin stratus
#

I also never touched online splitscreen

high current
#

idk, I am trying to make use of these 4 weeks

#

wait, I played 4 player split screen on Hoverloop

#

or do you mean that you havent tried to have a client play in split screen, while networked

thin stratus
#

Correct

#

We avoid online splitscreen

#
  • most splitscreen stuff in ue4 is literally just a second camera
#

And that's performance heavy af

high current
#

yeah, I have already removed the requirement for dynamic split screen, (the voronoi shit)

#

as James's research on that proved it will be rly hard to do

#

So we will stick with the default split screen wrapper, and avoid creating scene capture stuff

thin stratus
#

The UI in Hoverloop has a lot of custom stuff

#

Basically every usercontrol is a custom widget that wraps the native one

#
  • the whole umg setup is build up on a way that each widget can pass focus onto an inner widget
#

until it reachs a usercontrol

#

cause if your gamepad loses focus, you've a problem

high current
#

Any specifc reason you avoid online split screen?

thin stratus
#

No docs I guess

#

I know they have stuff in place for it

#

But after having splitcreen and online working, we tested crossing it

#

And it wasn't working directly

#

Didn't want to invest time into it

#

It costs too much performance anyway

high current
#

But, is there anything specific that would prevent this from working

#

Unless UE4 has some problem with 2+ possesed player controllers from a single client, idk what else would interfere

topaz agate
#

How can I have each player have different abilities for a turn based game? Would they each have a player controller so they have different unique turns?

twin juniper
#

I have a issue with my replication

#

What is going on?

#

This is my animation

#

D: what is causing this i cant figure it out

winged badger
#

animation blueprints aren't supported for networking

twin juniper
#

wait what

#

So how do i make my player walk

#

!?!?!

winged badger
#

you grab a replicated variable from the pawn or his movement component

twin juniper
#

from character/

#

BP

#

?

lost inlet
#

doing networking in BP looks like such a pain

twin juniper
#

MY players cant interact

#

lol

lost inlet
#

typically for your ABP you'd update the animation state in the Update Animation event, looking at the pawn's state

#

rather than updating variables directly from interactions, that doesn't really work that well over the network

twin juniper
#

So how would i do it

#

this is my anim blueprint

thin stratus
#

They already told you how.

twin juniper
#

But i cant get my boolean from my char

#

on m anim bp

thin stratus
#
  1. Animation Blueprints aren't replicated.
  2. You replicate the variables and states in the Pawn/Character.
  3. You get the variable inside of the AnimBP from the Pawn/Character and save them to AnimBP variables to further use them.
twin juniper
#

Replicated

#

In spawn char

#

That variable is in pawn

thin stratus
#

Buddy, it's really not more than we just explained.

twin juniper
#

Yeah but how do i get my char var

#

in the anim blueprint

thin stratus
#

By getting the OwningPlayerPawn

#

That node should even be in the event graph by default

#

right next to the update event

twin juniper
thin stratus
#

I seriously don't understand how peeps like you post in #work-in-progress how they push new gamemodes, but at the same time can't cast a pawn to their custom class.

#

Like, don't get me wrong, great you are doing this and learning it

twin juniper
#

well im working onit

thin stratus
#

But seriously, go a step back and learn the basics

twin juniper
#

I did

thin stratus
#

No you didn't. Casting is one, if not THE, most fundamental thing of C++/BPs

#

You should at all times know how to go from Pawn to BP_SurvivalCharacter

twin juniper
#

Ohh

#

I need to cast

#

im stupid

#

lol

#

πŸ˜‚

thin stratus
#

Right, you'll figure it out. I'm off to bed, cheers!

twin juniper
#

So i use update event

thin stratus
#

Yes

twin juniper
#

When i cast

#

Oh maybe i cant make it in the state itself

#

It crash when i click compile

#

!?!?!

#

What is wrong with ue4

#

I think i got it working now

#

YES IT WORKS thanks @thin stratus

#

I was a bit stupid but now i get how anim blueprints work

high current
#

Simply looking at the anim blueprint of either FPSTemplate or TPPTemplate characters would have helped you here. Just saying

summer tide
#

Anyone successfully network replicated a riding system either player riding a horse or a car?

random coral
#

@summer tide Never done that sorry, but isnt that built-in?

fluid flower
#

hey all, I've got voice chat to work ( using steam oss ) but the volume is super low, does anyone know how to bump it up?

grizzled stirrup
#

Agh AI returning true for IsLocallyControlled() on the listen server host's machine has thrown me off so much. If I want to make sure I'm only running code (UI stuff that wouldn't matter for AI) on the actual local human player controlling the game and not the AI, would this check be ideal? return OwningCharacter->GetIsLocallyControlled() && OwningPlayerController where the player controller gets set when the weapon is picked up?

fluid flower
#

IsLocallyControlled should return false on clients for AI controlled Pawns

#

Oh you mean on hosts machine

grizzled stirrup
#

Yeah only clients

#

So on the server they do return true

#

And run all the UI code

#

So it's best to have a separate check for IsLocalHumanPlayer() or something right?

fluid flower
#

there is IsLocalPlayerController

#

it depends on what you want to do

grizzled stirrup
#

Right but you'd still need a reference to a player controller to call that right?

#

So even returning true if a OwningPlayerController property is valid would be enough for the check I think

#

That property gets set whenever a weapon is equipped

#

And player controllers are local always so other clients wouldn't have access to them

fluid flower
#

for that node you can do GetController

#

then check if its a player or not

grizzled stirrup
#

Since I have a PlayerController property already in use in the class for other stuff it's probably simpler to just return if that ref is null or not

#

But thanks for the help

#

Good to know that IsLocallyControlled() does NOT mean local human player only

silent birch
#

In my game there is a timer that starts from 5 to 0 and I want if for example me I shoot you and I have +1 to the score and when the timer is 0 in the player who has the highest score it says you win and at the rest of the players you lose

#

Who knows it online?

faint lintel
#

Hello,
I have a very strange problem with multiplayer and I was unable to google this... :D
So im coding my multiplayer game using c++
and I made a rpc call UFUNCTION(Server, Reliable, WithValidation)
Now in the _Validation method when I return false;
The action is activated with a press of a button and now the strange part starts.
Im testing it using 2 New Editor Windows where one is host and other is client.
When the client presses the button that acitaves my _Validation method the Client will be sent to main menu(my default map), but when I do the same thing on the host, nothing happens.

It has not happened to me before, I have used rpc before, and I was unable to google this thing out...
My perfect scenario would be, that if _Validation returns false, nothing should happen.

grizzled stirrup
#

@faint lintel returning false means the player is a cheater and is kicked from the game

#

returning true means it's all good to let that RPC happen

silent birch
#

You can't help me?

grizzled stirrup
#

@silent birch reference shootergame they have exactly what you are looking for implemented nicely

faint lintel
#

Thank you @grizzled stirrup , I thought that when there is a cheater, that returning false would just prohibit the cheater to cheat, but continue playing

grizzled stirrup
#

πŸ˜„

#

that'd make multiplayer dev very easy, unfortunately your program has no idea about how the player is cheating, just that he is

twin sable
#

@faint lintel I think you're trying to use the _validation for something other than its meant to be used

silent birch
#

It's a discord server @grizzled stirrup?

twin sable
#

why not just do the validation manually and not call anything to the server

faint lintel
#

@twin sable seemed, I had a special jump mechanism, that was supposed to be allowed on special occations, I had made different methods for that already, so it was functioning, but then I decided to but it running through the server, and misunderstood _Validation purpose

grizzled stirrup
#

up until a very recent version, validation is necessary for server RPCs

silent birch
#

Who can't help me?

grizzled stirrup
#

Usually you set it to true if you don't need any validation

twin sable
#

kk

faint lintel
#

Thank you guys! πŸ™‚

grizzled stirrup
#

Is it acceptable to send a struct of data on every gunshot as opposed to a simple float for damage? For example if I wanted to send a float for damage, a bool for crit, an enum for the type of damage and the instigator actor, is that still fine considering it could be sent say 100 times a second if many players are firiing?

meager spade
#

why not?

#

as long as you serialize it

#

fortnite send a RPC for every shot

#

with hitscan

#

which includes a struct

grizzled stirrup
#

Ohhh very cool, is there info on how much info they send per shot?

#

Also how can I serialize it correctly?by not using UPROPERTY(Transient)?

meager spade
#

yah they send TargetData

#

technically it should be 3 RPC's per shot

#

but they batch it to a single RPC

#

as they use ability system for firing

#

search for FGameplayAbilityTargetData

grizzled stirrup
#

Thank you will look into that for some examples!

meager spade
#

thats what they send every shot

grizzled stirrup
#

As for the serializing question, should I be doing anything special per shot to serialize?

meager spade
#

just ensure your struct is as small as it can possibly be

#

use uint8 over int32, use FVector_NetQuantize over just a FVector

#

etc

#

bitpack your bools if you want, if you have 6 bools, put them one after each other, and use uint8 bSomeBool : 1;, etc

#

plenty of things you can do to make the struct as small as possible

dusky willow
grizzled stirrup
#

Thanks a lot Kaos!!

#

Also Actor references are 1 byte right?

#

As they are just an ID

meager spade
#

4

grizzled stirrup
#

Ah ok thanks

meager spade
#

well

#

depends

#

pointer is 4 bytes

grizzled stirrup
#

Yeah I'm sending an AController* and an AActor*

#

Then an enum a float and a bool

meager spade
#

do you need to send controller?

#

controllers are not replicated

grizzled stirrup
#

I don't need to , the server can actually calculate both the actor and the controller, but it's part of the struct

#

Is it less bandwidth to leave those entries empty?

#

And fill them on the server?

meager spade
#

what are you sending?

#

what struct?

grizzled stirrup
#

DamagingController / DamageCauser

#

A custom struct

meager spade
#

why not make your own lightweight struct specifically for replicating

grizzled stirrup
#

I calculate the damage info on the client and send it as a const MyStruct&

meager spade
#

FReplicatedHitInfo

#

which you send to the server

#

or something

grizzled stirrup
#

True I can split it up so the DamagingController / Causer are in a separate struct

meager spade
#

with jus the info you need

#

but i would just get it working with what you have now

grizzled stirrup
#

It's just that it's nice and clean to have a single const struct passed from the client through all the functions and health component etc.

meager spade
#

and make sure it works before you optimize

grizzled stirrup
#

True! It does work up until now but I was only sending a float before for damage and populating the struct on the server

#

Just added the type of damage and the crit which the client calculates in my case

#

But actually makes more sense to just have it all calculated on the server, thanks Kaos!

meager spade
#

rule of thumb is, replicate what is needed

#

replicating too much/un-needed stuff is wasted bandwidth

grizzled stirrup
#

I'm just in a strange position where I'm doing a lot of calculation on the client because it's not a PvP game

#

So the client has a lot of upgrade and other info that would influence the type of damage and the crit etc.

#

So I guess the best option would be split up into two structs, the stuff the client calculates and sends and the stuff the server has access to

meager spade
#

in fortnite they don't do calcs server side

#

client creates data of who he has hit, sends the location of the muzzle of the gun, rotation, etc

#

server just checks to see if its sane (i.e not stupidly out)

#

server ensures the firerate is ok (ie enough time has passed since last shot), then validates the shot, and applies the damage

#

server just does one simple trace to see if the shot was blocked by anything that came to the server (like in fortnite a wall going up) that would have blocked the shot

#

but apart from that, server does nothing else

grizzled stirrup
#

Very nice and lightweight

#

Are there threads on this info? Could learn about how FN does things for days

meager spade
#

i asked the question in the c++ forum

#

and got a reply from Epic Game's Dave Ratti (one of the Ability System programmers)

grizzled stirrup
#

Very nice!

meager spade
#

ill get link

grizzled stirrup
#

Thanks a lot!

#

I think I can get my struct down to a float, bool and enum which wouldn't be too bad per shot

meager spade
grizzled stirrup
#

Ty!

#

I wonder for their shotguns, would they have to send an array of those structs

#

As potentially a single shotgun blast could hit 3 different people

#

So 3 sets of separate data in terms of who was hit and how much damage was specifically done to each

meager spade
#

so..

#

TargetData RPC sends a TargetDataHandle

#

this can combine multiple TargetData structs

#

into a single struct

#

for things like shotgun with 5 pellets

#

its still one RPC

grizzled stirrup
#

What I have been doing before was an array of DamageAmount floats and an array of HitActors

#

Send both in one RPC

#

But with the struct this of couse gets more expensive as you are sending more data per hit

#

So with a 16 pellet shotgun that's potentially 16 structs

#

Per shot

meager spade
#

right but if you serialize your structs

#

and only send whats needed

#

its not that bad

grizzled stirrup
#

Again is there anything special to serialize other than using lightweight types like FVector_NetQuantize?

#

Will it be serialized automatically?

meager spade
#

yeah but sometimes you might want to write your own serializer

#

bool FGameplayAbilityTargetDataHandle::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
check out that

grizzled stirrup
#

Thank you will do!

#

And if only populating certain entries to the struct, would that be more lightweight than filling all with fresh data?

meager spade
#

its inside X:\UnrealEngine4.23\Engine\Plugins\Runtime\GameplayAbilities\Source\GameplayAbilities\Private\GameplayAbilityTargetTypes.cpp

#

but structs do serialize themselves

#

so it might be ok just to let the default serializations handle it

grizzled stirrup
#

Ok thanks I certainly don't have the XP to write my own at this point

meager spade
#

but don't be scared sending a struct over rpc

#

its more beneficial to send one struct over 4 pointers and a float sometimes

#

for simplicity aswell

grizzled stirrup
#

It does seem like a lot of info but yeah like you said, both for simplicity and sometimes you really need to send some extra info

#

A single damage float is fine for simple stuff but more features usually mean more data to be sent!@

#

And I'm sure the CMC is sending structs on tick via RPC πŸ˜„

#

Judging by some of the crazy examples I saw before there

#

So it's probably less data than I'm imagining

meager spade
#

yeah but Unreliable

grizzled stirrup
#

True

#

Still probably not near the freq I'd ever hit even firing fast weaps so all good!

#

Will be sure to use stat net

#

And keep an eye on the average there

grizzled stirrup
#

@meager spade Sorry last question πŸ˜„ If the struct contains an AController* and by default in the struct it is nullptr, does it cost the same when sending the struct with that AController being default (nullptr) via an RPC versus if it was set beforehand on the client and pointed to something? Would it take 4 bytes to send either way?

solar stirrup
#

is it possible to spawn an actor on the local machine only? iirc, if I spawn an actor (it's a widget holding actor, should only spawn locally) on the server it'll spawn for the clients too right?

grizzled stirrup
#

@solar stirrup Yes if you spawn after an if check of (if (Role < ROLE_Authority))

#

Or if you also need to factor listen server hosts in then check if the local player controller

solar stirrup
#

yeeeee but if it's a listen server host player

#

means that the listen server host player will accidentally spawn it for everyone

grizzled stirrup
#

Not if that object isn't replicated

#

If it's not replicated it'll only spawn on the listen server host machine

solar stirrup
#

well it ain't so that's great

#

ty

silent birch
#

Who speaks French?

#

You know it online?

winged badger
#

@grizzled stirrup yes, unless you do a custom netserialize

silent birch
#

@winged badger hello

winged badger
#

look at FHitResult::NetSerialize for an example, they use bitflags to communicate if they are sending some of the data there, and default it if they arne't

#

hi, i don't speak french πŸ˜„

#

doesn't matter if you could pack the nullptr in less then 4 bytes, if the struct on the receiving end expects it to be 4 bytes long

silent birch
#

I know @winged badger

#

You can't help me @winged badger?

winged badger
#

i am about to go for a walk, so im mostly afk for the next hour and change

silent birch
#

OK

winged badger
#

ask your question, plenty of people around

silent birch
#

But do you know about it online?

#

But he does not answer

tough totem
#

Someone know how I can run anim montages of AI's on Server, so that every player can see the montages?

grizzled stirrup
#

Thanks Zlo!

silent birch
#

The format of the images that we put as his game on unreal engine 4 what format?

grizzled stirrup
#

Use .tga

silent birch
#

@grizzled stirrup It's the right format?

grizzled stirrup
#

For most things yes it's an ideal format and used by Epic

silent birch
#

I know

#

@grizzled stirrup But do you know about it online?

meager spade
#

@tough totem You have to tell the simulated clients

#

either multicast it or replicate a property with a struct

fervent yacht
#

Isn't 4 bytes about the minimum size assigned to almost any variable anyway?

#

Depending on system but lol

meager spade
#

no

#

int8 is 1 byte

#

int16 is 2 bytes, int32 is 4 bytes, int64 is 8 bytes

#

pointer is 4 bytes, reference is 4 bytes

#

which is why its a lot of programmers send a const reference to a type over a certain amount of bytes, like a 20 byte struct copying it would be an additional 20 bytes where you could just send a reference to it at 4 bytes

tough totem
#

@meager spade Okay works. Thx so much

twin juniper
#

when you cast to the thirdpersonbp, and get the player character index, how does one match the index to the proper character in multiplayer? anyone have any suggestions on how to do this?

grizzled stirrup
#

Send a screenshot?

#

When you cast to a character, you get the reference to that particular character

twin juniper