#multiplayer

1 messages ยท Page 304 of 1

green berry
#

So sending to the widget doesn't need to go via the controller or pawn?

thin stratus
#

No

#

Ok so see it as this

#

Forget about widgets and the Character

green berry
#

Ok

thin stratus
#

The PlayerState only takes care of getting the name

#

and setting it to a replicated variable (in himself)

#

So it only takes care of getting and saving the varaible

#

Not of setting it in the PlayerCHaracter

#

Now, as a separated thing, you have your Character and the 3D Widget

#

Task now is: Get the PlayerState PlayerName into the 3D widget

#

Now the Character has an already existing pointer to the PlayerState

#

What you do is creating your widget, giving it a PlayerState variable and bind the PlayerName of that to the Text in your Widget

#

Then on begin Play of the Character

#

you simply pass the widget the PlayerState ref that your Character has

#

That's all

green berry
#

But the player doesn't have the right PlayerState, which is why I'm so confused.

#

Otherwise, I should just be able to ask for it now

thin stratus
#

It needs to have the correct one :O

green berry
#

Exactly, thasts wy I'm confused

thin stratus
#

The Variable "PlayerState" in your PlayerCharacter

#

To be sure, you could even pass the Widget the PlayerCharacter itself

#

And then get the PlayerState in the Widget itself

green berry
#

But it seems to me, that I'm having trouble because the UI I made is talking to a different Instance/State than the player once I've spawned

thin stratus
#

Hm, i don't really think that'S the problem

#

If you connect to a server

#

you get a unique PlayerController

#

A PlayerState

#

and then you Spawn a PlayerCharacter

#

and possess it

#

After that, you PlayerCharacter has a PlayerState pointer

#

that points to your PlayerState

#

It would break all net logic if that playerstate would be the wrong one

green berry
#

But I'm typing my name in before I connect to the server, so getting a new unique state is what's breaking

thin stratus
#

:O It can't be broken. I use the same stuff in all my Network project

#

Replicated PlayerName in the PlayerState and using the Controller and PlayerCharacter Pointer to access it

green berry
#

Don't say that, I'm pretty good at breaking things ๐Ÿ˜‰

thin stratus
#

Just do it like I told you above

green berry
#

Ok

green berry
#

@thin stratus So, I got a lot of this code from the Unreal MP Blueprint Tutorial. All my menu logic lives in the Instance.

#

In that, I GetPlayerController and SetPlayerName to the state

#

and then I should be able to fetch that name from the Widget, yeah?

thin stratus
#

What does the Menu Logic have to do with it

#

Aren't you talking about the Name of the Player above the PlayerCharacters head?

green berry
#

I don't know, just thought I'd mention it. The Unreal tutorial skipped the persistance issue by just loading from a default savegame name after connecting to the server

#

I've set it up so that once you've typed in your name > server name and hit start, it saves the name to the PlayerState

#

But that's running in the instance logic. Which seemed weird, but it was on the official channel.

#

I should scrap that, shouldn't I?

thin stratus
#

So, what ever you set in the PlayerState before you connect

#

will be scrapped afaik

#

You only have two ways, without a subsystem, to do that

#

Save it in a SaveGame

#

or in the GameInstance

#

As both survive the level change

#

So when you select the name in the mainmenu

#

you save it to the GameInstance

#

And then in the next level you retrieve it

#

but I thought that already worked for you?

steady verge
#

hi

green berry
#

But that's what I've been doing and you said not to

#

I was putting the name in the instance, then getting the player to state to get it back

#

That worked

#

The problem is that when I tried to get from the instance/State, I wasn't able to send the info to the right player

#

The player I was controlling had a new player state and instance

thin stratus
#

a Replicated Spawned PlayerCharacter

#

that is controlled by your PlayerController

#

has a PlayerState linked to it

#

if not, then something is really broken

#

And the GameInstance needs to be valid at all times

#

if not, then shits broken

steady verge
#

I am searching for help to package a multiplayer game, using a dedicated server, and a client

green berry
#

That's what I though

#

t

thin stratus
#

But you still haven't told me if oyu've done what I explained above

#

@steady verge Any specific problems?

steady verge
#

I 've cooked with Frontend my content, and I ve build with VS my server exe

#

but I don't know to launch my server and my client, where to put content and exe together

thin stratus
#

If your Server is compiled

steady verge
#

for moment, my server.exe is launching, and quitting immediately, I don't know where to look at logs, and there is no error in console

thin stratus
#

And you used front end to package it

steady verge
#

I did

thin stratus
#

then you should have an .exe file for the Server

steady verge
#

too

thin stratus
#

And that's bascially it :x

#

Hm, it's closing direclty

#

Are you packaging shipping or dev build?

steady verge
#

sorry I got a window error

#

failed to open descriptor file ../../..Engine/pocshim.uproject

#

My aim is to package, and to copy it on a server I own

thin stratus
#

That's the error for the Server?

steady verge
#

yes

thin stratus
#

Did you actually select to package a Server

#

In the FrontEnd?

steady verge
#

my build configruation is on developpement option

#

no

#

package & store locally

thin stratus
#

Afaik, you need to use the Source version of the Engine

#

and that should also have a Source version of the frontend

#

both feature the code to actually compile the Server and package it

#

I haven't done this in a while

#

but that error is weird, as it shouldn't require a uproject file

steady verge
#

yeah, I didn't see lot of documentation.... It seems lot of people did solo game, and/or never deliver it ๐Ÿ˜‰

#

yeah I agree

#

There is no topic about, what happens after (trouble, error, how to make it right on a different server....)

#

One day, I make it run, but I didn't write anything on how I make it successfull.... bad time for me

#

This time I think I will write some blog post ๐Ÿ˜‰

green berry
#

@thin stratus Your answer still relies on the character accessing the PlayerState to get the name

thin stratus
#

Correct

#

And that works

green berry
#

It won't. because something is very broken in my game

#

That's what I've been confused over for a week now

#

All of the things I've tried should work

#

and I can't see why I'm getting the wrong info

#

So, I put the code you said in to PlayerInfo and PrintString the info

thin stratus
#

And if you want to make sure that PlayerState is valid

#

you do this

green berry
#

My character has a valid player state, but the values are the defaults

thin stratus
#

And get the PlayerState from that ref inside the Widget

#

In a binding

#

The Values are the default?

green berry
#

Yeah, that's what I'm saying. The playerstate that comes from the menus is not the same as the ones that players are seeing

#

They're both valid, just not connected

thin stratus
#

From the Menus?!

#

MainMenu PlayerState != GamePlay PlayerState

green berry
#

Sorry, been awake for a while

#

I mean the player state that gets the right name from the instance

#

It's able to send that name somewhere, but not the controller I'm controlling

#

and vice-versa

#

i.e. it's knackered

#

Maybe I should write it all again, because this doesn't seem like it should be happening, you're right that this should all be easy

thin stratus
#

Just so we are on the same end

#

This is how it works

#

or should work

#

PlayerController, of course, only exists on the Server and the Owning Client

#

Client A doesn't have PlayerController B

#

They all have the PlayerStates and the PlayerCharacter though

#

And normally, the PlayerState B is owned by the PlayerContorller B

#

which would return exactly that on the Server and the Owning Client

#

Would return Null on the other clients of course

#

So after possessing Character B with PC B

#

Character B should point to PlayerState B

#

if not, then my life is a lie

green berry
#

I think I get that, but I could be wrong, so I'll go through what I think that code we did does and we'll see....

#

The PlayerState loads and check Auth, which means it only runs on the server version

#

Then it told the local client to get the name from its instance save it in the server player state

#

then on the server, it sets the rep notify variable and the client sets its text to the name we sent, which is the one the server version of the PlayerState holds

#

and that should all happen for each client when they log in to the server

#

Yeah?

thin stratus
#

Ok so,

PlayerState A, the one of Client A, spawns. Calls BeginPlay on all Instances.
Means Server, Client A and Client B.
It then limits the call to the Server instance with the Authority.
It then goes to Client A Version (owning Client is Client A!) and asks him for the
Name. Since we are on Client A now, the GameInstance is also the one of Client A.
We are really ON the Game of Client A at this point.
Now we pass it back to the Server (if owning client!, that's why Server RPCs don't work on Server owned actors), and he sets the Replicated Variable.
That Variable will now update (with a small delay based on ping) on Client A and B

#

At this point, you successfully got and replicated the Variable

#

Then it comes to getting this Variable to other Actors

#

Such as the PlayerCharacter

#

The Idea of getting the Owner in the OnRep Function doesn't work, as OnRep gets called on Client A and Client B

#

And if the Owner is the PlayerController

#

Then Client B will get "null"

#

So you need to do it differently

green berry
#

Ok.

thin stratus
#

That's where I want you to use the 3D Widget

#

Because at this point, we have PlayerState A with a Replicated Variable on all Clients and Server

#

So here you now go and go to the PlayerCharacter

green berry
#

One moment

#

If I test this by running one instance as a nondedicated server, I'm still not seeing the right name in my player state

thin stratus
#

So only one Player?

green berry
#

Yeah

thin stratus
#

Does he call the Authority node?

#

If you only type in a "1" to the settings and don't use a Dedicated Server, you might start as a Player without any network connection. So he's not even a ListenServer

#

Could totally be that replication logic fails at that point

#

In a normal situation, you always have a Server

#

It shouldn't fail though iirc

green berry
#

It was set using the authority node, I'm just trying to see how I check it from the controller

thin stratus
#

uff

#

this is all getting way to complicated

green berry
#

I thoughtt the controller needed to see it anyway

thin stratus
#

Forget about the Controller

#

It's not important here at all

#

Despite possessing the pawn

green berry
#

Ok

thin stratus
#

First goal for you, is to have the correct PlayerName, in your PlayerState PlayerName variable

green berry
#

That's always worked

#

Now I'm in my widget

thin stratus
#

Ok, in the Widget, create a PlayerCharacter reference

#

Then create a BINDING Function for the Widget Text you probably created in the Designer

green berry
#

Done

thin stratus
#

In that function, you check if the PlayerCharacter ref is valid, if yes, yo uget the PlayerState of it and also check if it's valid

#

Then you cast it and get the PlayerName from it

#

And set that as the out put

#

aka return value

green berry
#

Done

thin stratus
#

Then, for the sake of having it properly, copy paste the Return node

#

and connect it to the "Not valid" and "Cast failed" execs

#

cause the widgets wants to know what value to use if they are not valid

#

(general rule, a function needs to return a value on all possible exec ways)

#

Othterwise you will see blue warning anyway

#

So now, in your PlayerCharacter

#

Add a Widget Component

#

and select the Widget class in teh details panel

#

And then do this in teh BeginPlay of the Character

#

And that should be it :x

green berry
#

@thin stratus

thin stratus
#

Ehm

#

You are not using your own playername variable there

#

You are using the one that already exists in the PlayerState

green berry
#

That's for error checking, because it's a VR char and that's a pain to look at in game

#

MachineName-2ds5a4ds

#

That's what it's setting too

#

So it's getting there

#

Er, isn't that readonly?

thin stratus
#

Yes and no

#

The variable is read only

#

But you can change it with either a console command

#

or a gamemode function

#

When you are on the Server Version of the PlayerState again

#

Where you would set the variable

#

get your GameMode

#

and call "ChangeName"

#

And for the Player you get the Owner of the Playerstate and cast it to playercontroller

#

Simpler would be replacing the Var with your own though

green berry
#

I've got a custom variable in my on VRPlayerState

thin stratus
#

Yeah then use that?

#

Cast the PlayerState ref to your custom PlayerState

#

and use that

#

Casting on tick is quite mรคh, but it's okay for now

green berry
#

That returns the default value

#

Hence all the headache

thin stratus
#

:P it shouldn't

green berry
#

I know ๐Ÿ˜„

#

I understand well enough to have already tried it

thin stratus
#

If it returns the default value

#

it's not correctly setting it xD

green berry
#

It's setting it on the wrong PlayerState, but it's working on a playerstate

#

I PrintString the result and it prints the right value

#

I bet you wish you hadn't started helping ๐Ÿ˜‰

thin stratus
#

Not true

#

I just don't understand where it's going wrong

#

Let's forget about the PlayerCharacter for a second

green berry
#

You know what, it's probably too hard to figure out remotely

thin stratus
#

In your PlayerState, if you Print the custom PlayerName on tick

#

Does everyone print the correct PlayerNames?

green berry
#

I know what that's like

#

I'm going to start a project from scratch and take it in stages, do everything properly.

#

What I've done here is take 3 different parts and mashed them together and broken something

#

I have the VRPlugin going, the MP blueprint tutorial and bunch of stuff I wrote myself for single player

thin stratus
#

Bah, the MP tutorial

green berry
#

Yeah...

#

I think I understand enough to do that myself

#

and here was me hoping to get some sleep this year...

#

Thanks loads for the help, it's been really... helpful ๐Ÿ˜ƒ

unique patio
#

Hmm does anyone have an idea why my transforms are set upside down and offset on the client.. but not on the server pawn. in this case? it's not just clientside. but all pawns but the one who is on the listenserver has the wierd transforms.

signal lance
#

Hi, Can components call RPCs? I am asking this because I tried to replicate a variable with an RPC function on a component and it didn't work, I did the same thing on an actor and it worked perfectly.

fleet sluice
#

I think components aren't replicated by default.

#

So you should check the checkbox for RPCs to work.

#

Are you the guy with the Modular Vehicle on the MP btw?

#

@signal lance

signal lance
fleet sluice
#

My bad, I mixed stuff in my head, I knew I remembered something interesting related to you: https://forums.unrealengine.com/showthread.php?119270-Marketplace-C-Plugin-Air-resistance-simulation

#

I'm particularly interested in buying this

#

<--- Aerospace background

#

Is it scripted with basic aerodynamics in mind or does it also include stability/aeroelasticity?

signal lance
#

It basically simulates the force based on the current speed of that specific component, it is not really accurate to real world physics but it does the job. I decided to sell it as a part of another plugin that I am working on.

fleet sluice
#

I see.. Thanks! If you could add at least flutter/buffetting, I'd be your no. 1 fan, but I doubt that's too feasible for a generic vid game aircraft

#

Did that component rep stuff work?

signal lance
#

I am going to try it later. I will definitely do some more research so I can improve the simulation before I release it.

snow cliff
#

hey guys

#

I can't get the multiplayer shootout example to work over my network

#

neither the multiplayer code from it in my own project

#

if i run the program twice on my computer it works fine

stiff wasp
#

What subsystem are you using?

snow cliff
#

steam on the multiplayer shootout, none on my projects

#

[OnlineSubsystem]
DefaultPlatformService=Null thats what you mean?

stiff wasp
#

alright, so is steam open on both computers? And is your project using app id 480?

#

Yea

#

if you want to do internet you should use steam.

#

Null will only work for LAN play

snow cliff
#

yeah, that would be a start ๐Ÿ˜„

#

so I just want it to work in Lan for a start

#

but i can't see games I host on the other computer

stiff wasp
#

Can I see your code for hosting/joining a session?

snow cliff
#

it is literally the Multiplayer shootout example i am running

#

but I can send you the code, sec

#

do i need to run steam even if i only want to find games on lan?

#

And i mean, if i run the program twice on my computer I can join sessions with no problem

signal lance
#

if you use steam you need to have a separate account for each machine

snow cliff
#

I have so many steam accounts

#

thats not the problem

stiff wasp
#

no you don't need steam if you are using LAN

snow cliff
stiff wasp
#

is EnableLAN check to true?

snow cliff
#

you can set that in the menu

#

doesn't work with any combination

#

I am using win 7 on one pc and win 10 on the other

#

I got it working some time ago, but I think that was with 2x Win7

#

oh wow i got it running over evolve

#

Thanks for your help guys!

flint hedge
#

is there a way to enable the client to use inputs? Currently when my client joins a server they aren't allowed to use input controls from the player character

stiff wasp
#

inputs as in input actions? Yes, clients can use them

gaunt kestrel
#

Does anyone have a check list of all that is needed for a multiplayer lan setup?

Or an example? I think my blueprints set up but want to compare

thin stratus
#

You mean to connect?

#

And host?

#

@gaunt kestrel

gaunt kestrel
#

I just want my, and my friends computers to play together

thin stratus
#

Well, a list of what you need for the base of all bases of LAN play: The direct IP connection:

  • An "OpenLevel" node, with "listen" as an option, to host a game.
  • An "ExecuteConsoleCommand" node, with "open IPADDRESS", to connect, while IPADDRESS the ip-address of your friends PC in LAN or even internet is
#

And a list of things you need for session based connection:

  • A "CreateSession" node to create a Session as the Host, followed by the OpenLevel Node with "listen" as an option again
  • A "FindSessions" node on the one who wants to connect to search the LAN for Sessions
  • A "JoinSession" node to connect to the hopefully found session
  • A "DestroySession" node, for when you enter the MainMenu again, cause you need to detroy your session to actually connect/host a second time (otherwise you might need to restart the game every time
#

@gaunt kestrel Woudl that answer your request?

gaunt kestrel
#

@thin stratus this is very helpful!

Does the Open level, listen, and ExecuteConsoleCommand happen in the game mode blueprint?

thin stratus
#

I normally put this into the GameInstance

#

And call it from my widgets

gaunt kestrel
#

Oops the "Find Session" one casts to GameInstance and calls the "Find Session event"

thin stratus
#

Yes, something like that

#

Of course you want to make sure that the Session array is actualyl not empty before getting the 0 entry

#

and you may want to increase the number of results

#

The CreateSession event should only call the OpenLevel when it succeeds

#

and not in the normal call

#

so disconnect the upper exec

#

the console commadn is not needed

#

OpenLevel with the listen option is enough

#

And you should not cast the PlayerController to GameInstance

#

But the "GetGameInstance"

#

I mean, makes no sense to cast the PlayerController to the gameinstance :P

#

@gaunt kestrel

gaunt kestrel
#

better? I was searching if I should use length or last index for the array.

#

How do I test this?
And
Which player start would each player use?

stiff wasp
#

For the player starts you'll need to create spawning logic of you want to tell them to spawn at a specific point. This should be done in the game mode class.

wise depot
#

if an actor is marked for replication, and I destroy it on the server, will that destroy it for all networked clients too?

#

or do I need to call it to be destroyed on each client too?

signal lance
#

I think it should destroy it on all clients.

thin stratus
#

LastIndex is Length-1. Arrays start at 0 and go to Length-1.
If you want to know if something is in it, youcheck if the Length is greater 0.
And you are still calling "OpenLevel" on both execs, remove the upper one, otherwise it will open the level directly instead of waiting for the creation process to finish

#

@gaunt kestrel

wise depot
#

i don't suppose any of you know what bIsSystemWide is used for in the voice stuff?

hollow bear
#

Sorta Ue4 related, I'm trying to pass a message through TCP but I was wondering if any of you knew or had a simple TCP listener so that I can see the read out of the message in that program.

thorn merlin
#

you could use wireshark and just sniff the line

gaunt kestrel
#

@thin stratus Oh okay thank you! I googled it but apparently read the wrong forum post.

#
signal lance
#

I am working on custom client - side prediction system for my project and I am curious if there is anything similar to Tick but for Net updates. Currently I am executing my logic on Tick and if the framerate is low it gets very laggy. Standard Movement replication seems like it is framerate independent. I am doing this in C++, thanks.

gaunt kestrel
#

@signal lance Try setting a timer that checks every x seconds

#

the starts on Event Begin Play

signal lance
#

Hmm, I will try that, thanks

dreamy schooner
#

Hey guys, quick question for any multiplayer pro that might find themselves hanging out in the UE4 Discord. I want to edit a material parameter to change the colour of a player. The 'LinearColor' variable is set in the player state and the DMI functions to handle this are called on the characters BeginPlay. I'm struggling figuring out how to have each players specific colour appear on all clients/server. Anyone got a quick tip or ideas?

brittle sinew
#

You should be able to get the pawn's PlayerState directly, no? @dreamy schooner

#

Though I'm not 100% sure it's always available at BeginPlay, in which case you could use OnRep_PlayerState

#

And you probably should use that, just to avoid any race conditions

#

Even if you find it works on BeginPlay over LAN or in a single instance, it would most likely fail often over the internet

gaunt kestrel
#

Does LAN include over ethernet?

#

ie, can I plug my ethernet into my friends computer and using LAN connet with him?

brittle sinew
#

You would need a certain type of cable, forgetting the name atm

#

Crossover

dreamy schooner
#

@brittle sinew Where should I access the PlayerState from? Through the game mode using a loop to run through each player character?

brittle sinew
#

Well, you could just access it on the character directly

#

If you put it in OnRep_PlayerState, it'll get called on all clients as soon as the PlayerState arrives

dreamy schooner
#

I'm currently calling a function "SetupPlayerCustomistion" on players BeginPlay which then talks to the PlayerState to retrieve the colour and set the material parameter. But this doesn't show on both client/server.

brittle sinew
#

Could you show me how you're doing it?

#

And again, if the PlayerState doesn't exist when BeginPlay is called, nothing will happen

#

So it's best to use the OnRep function

dreamy schooner
#

I just used the RepNotify to call "SetupPlayerCustomisation" and am having positive results. The server now has the correct colour displayed on both, but the client is using the default parameter value, set in the material. I'll snap a quick screenshot to show you what I'm talking about.

gaunt kestrel
#

So if I have a crossover cable, connect it to both computers, should it work?

brittle sinew
#

You might run into network connection issues, I really have no idea

#

Is there any issue with connecting to the router via wifi or ethernet?

dreamy schooner
#

Top is server, bottom is client. Both should be showing the orange circle, which is set in the PlayerState. The purple is just the default value of the "colour" parameter.

brittle sinew
#

Sure, but do you mind showing at least the function and its call? Just want to make sure things are done how they should be

gaunt kestrel
#

@brittle sinew The place we'd be demoing doesnt have Wifi/Router

#

(SXSW)

brittle sinew
#

Ah, fair enough. I can't really help a ton on the networking side...all I can tell you is if you get the connection working then UE4 should work ๐Ÿ˜„

dreamy schooner
#

Both of these functions exist in the player character blueprint, but it seems to be only called for the server.

gaunt kestrel
#

@brittle sinew haha thanks

#

I'll ask around more

#

To reddit!

brittle sinew
#

Hmm, so are you saying that the customize function doesn't get called on clients? Because if so, that's something completely other than the PlayerState

dreamy schooner
#

It seems that way. Thinking of it now the HUD widget is also not added to the clients viewport, which is also done in BeginPlay. Could there be a reason the client player character is not calling BeginPlay?

brittle sinew
#

That should really never be the case, something weird might be up

dreamy schooner
#

When it first loads up the client camera is in the ground, not up in the air like the server, then after a second or so it snaps to normal. Is this normal?

brittle sinew
#

It could be that the possession is happening late? Not too sure, but a timing issue over MP might be in play

#

And just wondering, how did you get that OnRep function in BP? Doesn't look exposed to BP by default, but I could be overlooking something really stupid hahaha

dreamy schooner
#

When I set the PlayerState variable to "RepNotify" in the Replication drop down box, it was created automatically.

brittle sinew
#

Oh, so is this a variable you created yourself?

dreamy schooner
#

Yeah. Is that not the correct way to access it?

brittle sinew
#

Well, APawn has a PlayerState variable by default that gets set automatically within its code

#

That's what I was referring to; it might be hard to get the PlayerStates all working out of the box by scratch

dreamy schooner
#

I get the default player state, then cast it to my PlayerstateBP, which then gets set to the variable that I am accessing.

brittle sinew
#

Ah, okay. Then there definitely is a bigger issue with BeginPlay not being called and the OnRep not being called

gaunt kestrel
#

Well I posted on reddit.

dreamy schooner
#

I think only certain parts of BeginPlay are not being called, both characters have weapons spawned and attached to them, which is a function called by BeginPlay. Could be a cast failing. I will inventigate.

brittle sinew
#

I don't imagine the question has much to do with UE4 at all at this point really @gaunt kestrel

#

More if you can get the network setup at all

gaunt kestrel
#

I'm pretty sure i have the network setup

#

my partner is just away for christmas

#

so I cant test it

dreamy schooner
#

So after using delays and print strings I've discovered that it takes a second for the player state to get up and running. So maybe it isn't the best place to store customisation information. What kind of variables and functions are best placed in the player state? Where should I keep customisation information like player colour?

thin stratus
#

Well, if it works on your PC

#

then ti works for your friend

#

despite the fact that he might have a firewall that blocks you

#

@dreamy schooner PlayerState is used to store information about a specific player, while making sure it's available for everyone else

#

Score, PlayerName, TeamNumber

#

Of course, with 4.14 you can limit replication to the owner in blueprints

#

So you could also not share replication with everyone

#

So if you have a variable for the color of your player, which should survive the Character death (destroy actor)

#

and it should be visible for everyone else

#

then yeah, PlayerState

dreamy schooner
#

Yeah it sounds like I have it in the right place. Any ideas why the player state doesn't seem to be accessible straight away on BeginPlay? If I delay the colour setting function by a couple seconds everything works.

thin stratus
#

You have a few things to deal with

#

PlayerCharacter and PlayerState are spawned when the game starts. While the PlayerCharacter could also be delayed by taking care of spawning him yourself

#

In general, you can't say if the PlayerState or the PlayerCharacter are spawned first

#

The second thing you need to pay attention to is the replication itself

#

Let's say the PlayerCharacter and the PlayerState spawn in the correct order and you can acces it

#

Nothing tells you that the color variable is actually already replicated when you try to access it on the Clients

#

So the best idea might be the following

#

You'll have the Variable in the PlayerState, either replicated or just on the Server, doesn't really matter.

#

Then you have the SAME* variable on the character class

#

Replicated with RepNotify

#

At BeginPlay of your Character, you try to access the PlayerState

#

Which is probably not working :P

#

Cause the BeginPlay gets called when you spawn the Pawn

#

the PlayerState variable is valid when you possess the Pawn

#

So the pawn calls begin play probably before you possess it, which makes controller and playerstate invalid in the Character

#

So you might wanna try the other way round

#

And on beginPlay of the PlayerState, (Switch has authority -> Authority exec) try to get teh PlayerPawn and pass it the color

#

And to make sure that you have it save in both directions, you use the Pawns "OnPossessed" function

#

WHich is called when it gets possessed. Should only get called on the server

#

In there, you should be able to get the PlayerState from the passed Controller

#

Might even be that you only need the OnPossessed event

dreamy schooner
#

Some good ideas, i'll try them out. Thanks for going over that for me.

thin stratus
#

I would try the OnPossessed first

#

Might be that the BeginPlay of the PlayerState isn't even needed

#

And yeah, cheers :P

gaunt kestrel
#

I think I have my issue resolved

I'm going to buy a switch and set both computers IPs to static.

signal lance
#

@thin stratus Do you maybe have any tips for this, someone suggested a timer but it is still very laggy. "I am working on custom client - side prediction system for my project and I am curious if there is anything similar to Tick but for Net updates. Currently I am executing my logic on Tick and if the framerate is low it gets very laggy. Standard Movement replication seems like it is framerate independent. I am doing this in C++, thanks."

thin stratus
#

Hm, don't know tbh

#

Could probably check some stuff out, but no time for that atm, sorry buddy

signal lance
#

Ok, thanks

jolly siren
#

ugh for some reason I can do a POST and send a variable and it works fine. but when I do a GET the same variable isn't coming across

#

๐Ÿ˜ฑ

#

hm

#

is SetContentAsString not meant for GET?

#

should I just be passing the parameter in SetURL instead?

jolly siren
#

so what are steam leadersboards? is that for storing persistent player data? like level, kills, deaths, etc? does steam have built in stuff like that where it stores to a db?

twin juniper
#

hey guys

#

when using sessions

#

do you still use the regular RPC functions

#

to replicate stuff over the network

jolly siren
#

ye

twin juniper
#

hm

#

also for sonme reason

#

ever since we moved to 4.14

#

steam overlay isnt working now

#

lul

jolly siren
#

i'm not on 14 yet, sorry

twin juniper
#

yeah

#

they added this new thing

#

that basically u have to include all of your plugins

#

inside of your .uproject file

#

took us like 4 days to figure it out

jolly siren
#

yeah I know about that

#

they separated the subsystem stuff from core

twin juniper
#

o.o?

#

how so

jolly siren
#

into plugins..

twin juniper
#

what is this new plugin

#

"Online Framework Plugin"

jolly siren
#

probably a base one for others to build upon idk

#

does anyone know how game menus work, like with dota2/LoL when you are at the menus are you connected to a server? currently in my game you don't connect to a server until you join a game. however, I am wanting to do http requests at the menu to retrieve things like the player's profile (stats). If I do this from the server I can't replicate the data to the client yet because he isn't connected to a server. And isn't it unsafe to do http requests directly from the client to retrieve data from a database?

twin juniper
#

btw

#

what do u think is better

#

widget UI

#

or slate?

thin stratus
#

Widgets are Slate

twin juniper
#

yeah

thin stratus
#

Slates offers more

twin juniper
#

yeah

thin stratus
#

I wouldn't use it until you actually need it

twin juniper
#

thats what it seems like to me lol

fringe dove
#

and I'm wondering why they send an input vector over reliable RPC for their dodges--isn't the input vector already part of what's being sent normally?

thin stratus
#

Hm

#

That code in there seems a bit messy @fringe dove

#

The Variable Name are kinda off

#
void UMyCharacterMovement::ServerSetMoveDirection_Implementation(const FVector& MoveDir)
{
    MoveDirection = DodgeDir;
}
#

DodgeDir is only ever mentioned here and I'm kinda sure he meant MoveDir as that's what you get passed from the Client

#

Same thing here:

if (!CharacterOwner)
    {
        return;
    }
 
    //Store movement vector
    if (PawnOwner->IsLocallyControlled())
    {
        MoveDirection = PawnOwner->GetLastMovementInputVector();
    }
#

CharacterOwner gets checked but he uses PawnOwner

#

Maybe I'm just missing something, as I haven't read all of the tutorial

vivid siren
#

hey, dumb question, but my steam overlay doesn't show up in my standalone or in-editor game

#

i even tried the templates and they won't work either. i'm correctly adding the settings required in the ini, but still no overlay

#

I know 4.13 moved some of the stuff into plugins, but enabling the Steam networking plugin doesn't solve it either

modern fable
#

what documentation did you follow

#

I remember doing Steam and there was something missing

#

@vivid siren

vivid siren
fossil spoke
#

Steam is not available in-editor. You need to use Standalone

vivid siren
#

i've done full builds as well but they dont work either @fossil spoke

fossil spoke
#

Are you logged into Steam?

vivid siren
#

yes

#

I'm going to make a new 4.13.2 fps template

modern fable
#

is it a BP project

vivid siren
#

Yes

#

And I just enabled the Online Subsystem Steam plugin

#

now I'm going to update the ini file

#

now I'll restart editor

#

and im doing a window 64bit build now

#

oh

#

i guess i did something different this time

#

well uh, thanks, it works this time, lmao

modern fable
#

lul

vivid siren
#

i think i had spaced in my ini file the first time tbh

modern fable
#

are we talking about a packaged build or a standalone instance right form the editor

vivid siren
#

standalone

modern fable
#

rite, so a question

#

is adding / updating / whatever Steamworks manually to your packaged builds still a thing

vivid siren
#

no, as far as i'm aware

#

im pretty sure all of the steamworks and sdk stuff is now included with the newer versions of ue4

modern fable
#

hopefully ๐Ÿ˜„

fossil spoke
#

When the SDK gets updated id say Epic will include the new version in the next release of the Engine.

vivid siren
#

hey if i'm testing steam sessions, is it possible to join myself?

#

say if i run two instances of the standalone version of my game, would i be able to host on one and join with the other?

#

i assume no because both are using the same steam account, but i thought i'd ask

fossil spoke
#

No you cant. You need 2 accounts

vivid siren
#

thanks!

thin stratus
#

2 accounts might also mean 2 pcs

#

It's a bit annoying to test stuff for steam sessions when working alone

magic gazelle
#

Well, you can install a virtual machine and test it out like that, worked for me

loud sage
#

Argh VM's are soo slow for that, but yeah it's normally your only option ๐Ÿ˜ฆ

fierce birch
#

normally?

#

it's not that uncommon to have multiple computers around ๐Ÿ˜ƒ

loud sage
#

๐Ÿ˜›

#

It's pretty common to have like 2/3 computers around I gess, heck I have like 6/7 that I own. Just only 1 that can even run ue4, the rest is 32 bit / waaaay to slow and crashes as soon as I load ue4 up

bronze lava
#

Hey all, how do I possess a pawn in multiplayer? It seems really random, sometimes the server gets a pawn, sometimes only one client, etc. I'm using GameMode to possess and spawn the characters.

loud sage
#

If you mean when a client joins, the gamemode will use some (overridable) logic to try and find the optimal player start. Your issue sounds a bit like that you have a character which autoposessses instead of multiple player starts, but I'm a newbie and could be wrong ^^

bronze lava
#

Thanks. I do have auto-possess set to disabled, though.

loud sage
#

Try removing just a character and only having player start things

#

Not sure if that'd fix it, but it sure does sound like something caused by that

bronze lava
#

I don't have any playercharacters in my level, they are all spawned by the with OnPostLogin. However, when a client joins, no playercharacter seems to even spawn.

#

by the gamemode*

loud sage
#

Hm

#

Welp I'm a MP newbie but perhaps if I summon @thin stratus he knows the awnser? ๐Ÿ˜ƒ

bronze lava
#

Haha, go for it ๐Ÿ˜ƒ

#

For reference, here's what my OnPostLogin looks like:

loud sage
#

Oh you are doing it like that, I may actually know the issue ^^

#

So you are supposed to not be using OnPostLogin for that. ue4 spawns players by setting the player character in the gamemode and using a function in the gamemode to find the best player start object ๐Ÿ˜ƒ It'll create and posess the player's pawn there. If that makes sense

bronze lava
#

Alright, thanks. However, being a newbie, how would I go about doing this then? ๐Ÿ˜ƒ

loud sage
#

Just disconnect that code you connected to on begin play, and place a few of these in your level:

#

now 1 sec while I boot up my other project ๐Ÿ˜ƒ

bronze lava
#

BeginPlay or OnPostLogin? I have no code on my BeginPlay :/

loud sage
#

OnPostLogin*

#

sorry

thin stratus
#

He can totally use the OnPostLogin if he removes the DefaultPawn from the GameMode

#

Otherwise he will have multiple unused pawns

#

Also the SpawnActor node should make sure to ALWAYS SPAWN, instead of Default

loud sage
#

Yeah but he said that code was unreliable

#

But yeah you are the expert ^^

thin stratus
#

Cause if it doesn't spawn due to colliding, there won't be a pawn

bronze lava
#

My "Default Pawn Class" is empty, if that is what you meant

thin stratus
#

Yeah, then you can totally use the OnPostLogin

loud sage
#

Also something I'd personally reccomend is hooking up a print statement to the is not valid, atleast for debugging

thin stratus
#

The code looks fine, just change the Collision setting of the SpawnActor node to "Always"

loud sage
#

@thin stratus doesn't it still spawn in a default sphere pawn?

thin stratus
#

and also, you don't need the SwitchHasAuthority there

loud sage
#

Atleast that's what I had last time

thin stratus
#

Cause GameMode doesn't exist on Clients

bronze lava
#

Thanks, trying it out.

thin stratus
#

@loud sage No

#

If you don't spawn any Actor, you'll sit with your "Camera" at the PlayerController position

loud sage
#

Hm

#

I'll have to double check that old project then ๐Ÿ˜ƒ

bronze lava
#

Now my Server and Client 2 do get a pawn, but Client 1 doesn't. :/

#

And I tried printing if IsNotValid but that doesn't seem to be the error here

loud sage
#

Anyone happen to know what's wrong with this code? When I connect a client the client just resets to the default map, and doesn't open the map I open here (the server however does move to the specified open map)

#

And that's an odd issue. hm

bronze lava
#

Sorry I can't help with that, I just use Execute console command and "open levelname?listen" :/

loud sage
#

aha, I'll try that, ty in advance ๐Ÿ˜ƒ

bronze lava
#

If you decide to try that, you'll have to use "open ipaddresshere" on the client

#

But no problem.

#

Tried removing SwitchHasAuthority, unfortunately the same thing happens where only the server and the last client that joins get a pawn.

loud sage
#

What if you'd add a random unit vector * 100 or something. That'd give them a random offset sothat they wouldn't spawn in eachother

#

(no clue if that's it, but that's the only thing I could possibly think of)

bronze lava
#

I'll try it, but don't think it's the case as the server and client do spawn inside eachother but then quickly snap into a new position.

loud sage
#

Yeah

#

I doubt it too, but atleast it's something to stripe of your possible causes list ๐Ÿ˜ƒ

bronze lava
#

True ๐Ÿ˜„

#

Alright that wasn't the case :/

#

I feel like OnPostLogin isn't getting triggered by the middle-client.

#

Apparently it is.

#

Setting "start players as spectators" made Client 1 a spectator, while Server and Client 2 were correctly spawned.

loud sage
#

Are you using a listen server?

#

I don't think so from what you said, but now I'm doubting

bronze lava
#

I'm just using the Editor... I selected number of players: 3

#

This is a bit creepy, because of using GameMode I can see a player on my main menu ๐Ÿ˜„

loud sage
#

Okay so a listen server ๐Ÿ˜ƒ Does the client that doesn't properly spawn happen to be in the editor viewport instead of a seperate window?

#

also lol ๐Ÿ˜›

bronze lava
#

It's a seperate window

#

The editor viewport is the server

loud sage
#

hm

#

Then I'm out of ideas, sorry ๐Ÿ˜ฆ Perhaps someone else knows tho ๐Ÿ˜ƒ

bronze lava
#

No problem

#

Apparently, after packing the package, it works. So it was just the editor play that didn't work. Weird.

loud sage
#

Wierd

#

Could you try instead of pressing the play button try pressing the arrow next to it?

#

And then play in seperate viewport (PIE)

#

*New Editor Window

bronze lava
#

Still doesn't work

loud sage
#

Well then I guess its editor related ยฏ_(ใƒ„)_/ยฏ

bronze lava
#

Seems like it, yeah. Well atleast it works in the packaged project ๐Ÿ˜ƒ

#

Woah. Whole PC crashed while packaging a project.

bronze lava
#

Hmm. The GameMode spawn/possess still doesn't work quite as I wanted it to. Even though Client 1 and 2 possess their pawns, the server doesn't possess one. There are also 2 extra pawns spawned that no controller possessess.

#

Is there a way to make it so that the server does not spawn a pawn at all for itself?

#

Actually, is there a node that first executes one thing, and after being recalled, executes another thing?

drowsy zodiac
#

Has anyone had any luck with "Server Travel"? I cant seem to drag clients to the new level with the server.

stiff wasp
#

Are you using seamless travel?

#

@drowsy zodiac

drowsy zodiac
#

@Minimpoun#3100 I am familiar with seamless travel as being necessary. To verify, I just need to turn it on in the game mode I use for the lobby?

#

@Minimpoun#3100

#

Didnt mean to link twice ๐Ÿ˜„

thin stratus
#

@drowsy zodiac There should be no need to use seamless travel. I'm not using it in my Lobby

#

As far as I understood, seamless travel also keeps the GameMode which makes less sense if you move from lobby to gameplay

#

Though no guarantee on that as i haven't played with it yet

drowsy zodiac
#

@thin stratusy situation is trying to server travel when connected through steam. My structure is following you workflow from your marketplace item. When i try to travel from lobby to game through steam the client always seams to time out

#

So I am having sessions if it makes a difference

thin stratus
#

Hm haven't tested Steam, but ServerTravel shouldn't do anything Steam related. At least i would think so. Does it work without steam?

drowsy zodiac
#

I haven't tried without steam. I will have to try it next test and double check.

thin stratus
#

I'm using sessions too

#

So no idea why it's failing. ServerTravel should just tell the clients to reconnect

drowsy zodiac
#

Only scenario have had to connect through IP is over a dedicated server, which I hadn't established my lobby system fir

#

Ill try without steam and see if it works and let you know

#

Over 2 IP connections rather than lan that is

thin stratus
#

You can use sessions in lan too without steam

#

No need to go back to ip connections

drowsy zodiac
#

Ok, ill try over lan

#

Wasnt sure if it would be a different scenario

thin stratus
#

It could totally be that steam sessions do something different. So simply turn off steam and use subsystemNULL in LAN

#

If the travel works there, then we can try new things

#

Off to bed now. Good luck o7

wary cedar
#

Can I disconnect one of clients when playing game in editor "New Editor Window (PIE)"?
I want to debug disconnection of a player

#

Or may be some suggestions how it can be done.

#

I found a simple solution, a player can be disconnected on console command "disconnect" in his console :)

#

and then it can be connected again on command "open 127.0.0.1"

bronze lava
#

@wary cedar Thank you, now I don't have to package my project every time ๐Ÿ˜ƒ

bronze lava
#

Is there a way to make UMG get a different variable depending on what Pawn you're possessing?

#

What I'm trying to do is: If I'm controlling FPC1, get the Health of FPC1. If controlling FPC2 (client 2), then get Health of FPC2.

fleet sluice
#

Use an interface with a const function on both pawns and script different implementations for that function on each character to return their own health

#

@bronze lava

bronze lava
#

Thanks, I'll try it.

slim flax
#

What are the DefaultEngine.ini setting for multiplayer over LAN

stiff wasp
#

@drowsy zodiac @thin stratus no you don't need seamless travel. I was asking because of you are using seamless travel then my answer would have been different.

gaunt kestrel
#

Has anyone had a sucsessful test of multiplayer on seperate computers after packaging?

I tried packaging and trying to connect both computers while using LAN on the same network but I kept failing to find and join the session

drowsy zodiac
#

I have had luck

gaunt kestrel
#

Anything special you did?

I'm trying it now with just the ThirdPersonTemplate

#

yeah it returned failed on the JoinSession failure

#

both computers were on the same network, and a session was found on my other computer

#

@thin stratus any ideas?

gaunt kestrel
gaunt kestrel
#

I got it working!

I created a session on one PC

#

then one the other PC I had to type in console "open [IPADRESS of other computer]" and it worked

drowsy zodiac
#

@Shanowzer#0144 nice! Always a nice feeling

thin stratus
#

@gaunt kestrel for IP connect, you don't need sessions

#

The server only needs to open a map with the listen option

red ledge
#

I have a question if it is possiable. I'm trying to show the steam friendlist in game and allow the player to invite them.
theortically speaking, everything should work as the code matches the little documentaion and examples there is and complies without problems, however, I don't get anything when I try and get them.

FriendsInterface->GetFriendsList(LocalPlayer->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendList);

retruns 0 results, shouldn't it retrun the steam friends I have?

gaunt kestrel
#

So we got it working! We can see each other in VR

However when the client tries to grab anything it doesn't let them

Currently setting every function to multicast, is that what I should be doing?

brittle sinew
#

Are you calling up to the server to do it? @gaunt kestrel

#

Multicasts can only be called from the server, not the client

gaunt kestrel
#

Calling up?

#

What casts from the client to the server?

brittle sinew
#

I mean running a client->server rpc to do it

gaunt kestrel
#

RPC? I googled it a bit but only understood it a little

So I would need a separate event for the client to send to the server?

brittle sinew
#

Yeah, you need to make a "run on server" event that runs a multicast event on each client, and updates its position and other attributes

#

(at least I think, it might be a tad different in VR?)

#

You would also want to update it locally on the client so there isn't a delay

gaunt kestrel
#

Hmm well the possession events and movement is working (teleport and thumb pad). Health is working, all other valuables are

Just the grab isn't.

brittle sinew
#

@gaunt kestrel well, possession is handled on the server, movement in the CMC (I think in VR? If not, it's somewhere with an autonomous proxy), and health is most likely a replicated variable

#

I'm not exactly sure how grabbing works in VR, but you might need to manually replicate it

gaunt kestrel
#

Ok we've got it to show up on the server when the client grabs.

Now should I add an event that does the same thing called under the same button but replicated on owning client?

brittle sinew
#

Replicated to owning client would just send it right back

#

If you want everyone to see the location, you would need to multicast set its transform

#

Or, you might be able to set up autonomous proxy control on the character, but that's beyond my knowledge of implementation

drowsy zodiac
#

I am running into a weird issue where the server will not tick the anim graph for the animation blueprint of a client. I have unchecked replicate movement from the pawn and this turns off the server's update for the anim graph. A client is able to see another client's locomotion, but the server sees a frozen player. Is replicate movement tied into the anim graph somehow? Strange that it would be, which makes me think its a bug. Any opinions?

#

@thin stratus So server travel definetly works over lan, using sessions.

#

Matt Williams Has recently confirmed this

subtle spindle
#

Noob question, im following the unreal multiplayer tutorials and wondering is it hard to create a server that persists when it has 0 players playing? how does that work? can some one please explain breifly?

fossil spoke
#

Your talking about a Dedicated Server.

#

These are a seperate executable that is compiled by a source build. You cannot have a Dedicated Server with a Blurprint only project unfortunately.

subtle spindle
#

Is it difficult to add that functionality?

fossil spoke
#

No its quite easy actually for a bare bones setup yep.

subtle spindle
#

but if my unreal project is mostly blueprints will it not work?

fossil spoke
#

You need to have a source code build so that you can compile the Dedicated server executable yourself.

subtle spindle
#

heh sorry can you explain that abit simpler? new to all this stuff

fossil spoke
#

Do you have VisualStudio installed and have you compiled the engine from source code before?

subtle spindle
#

no and no, i know im getting waaaaayy ahead of myself, more just curious of how it works

#

do you have to turn your unreal project from blueprints into source code?

fossil spoke
#

I suggest you start looking into tutorials on how to build the engine from source code and working with C++ before trying to work with a dedicated server. You dont have to turn your BPs into C++ but you need an source build of the engine so you can build the server as well. If your using a Launcher build you wont be able to make a dedicated server.

subtle spindle
#

can you point me in the direction of a tutorial or some more information?

fossil spoke
#

Just google How to build UE4 from source code or something. Im not at a PC right now to find stuff for you haha sorry.

subtle spindle
#

Thats fine, thanks alot!

fossil spoke
#

No worries.

thin stratus
#

@gaunt kestrel You should really read my compendium before you continue. Going into multiplayer coding without knowing what a ServerRPC is, is not ideal. The compendium is pinned to this channel

#

@subtle spindle Your Project and the Engine are two different things. While you need to turn your project into a cpp one, by adding a c++ class via the editor, you also need to download the engine as source code. Currently you are using it via the launcher. That's easy to do if you know how, but i would suggest only looking into it if you need it

#

@JMan afaik, the animBP should not be replicated oO. It gets controlled by the variables that you have in your character BP and if your character is not replicated, then there are no values that you could use in the animBP. Or at least everything only happens on the owning client

lapis jetty
#

Having a tad bit of issue with replication of a Launch Character node within an event. Trying to get a networked dodge function up and running and it's not being friendly. Can someone help?

gaunt kestrel
#

Got it working! I didn't see that compendium @thin stratus so I'll read through it until I understand

flint hedge
#

I'm having a similar issue to Shanowzer...I have a multiplayer game where the client connects to the listen server. The server can open and interact with doors which is replicated to the client (the client sees the door open). The client can also open and shut the door, but the server doesn't see the door moving

#

I've used blueprint RPC's to try to get this to work but something isn't going right

#

This is what I'm working with, kinda just throwing more and more RPC's and replicated functions to try and force something to work

#

also, i've been reading through the compendium and trying the things it says but I'm not sure what i'm missing

thin stratus
#

@flint hedge You are using a Multicast when the button is pressed

#

that doesn't work

#

The Client will never call this

#

as this is saying "If Server"

#

the other problem is OwnerShip here.

#

You would need to call a ServerRPC to get the Server to call the Multicast

#

But ServerRPCs need to Client to own the Actor

#

Your door is probably placed into the level and owned by the Server

#

Read the Ownership chapter of my compendium

#

To resolve this issue, you would need to have a ServerRPC inside of a Client owned Actor

#

For example the PlayerController

#

So when V is pressed and (use switch has authority) it was a client, you get the PlayerController, call the ServerRPC( which should have an Input to pass the reference of that door)
and in that ServerRPC, you then call the Multicast on the door (which you passed)

#

That should solve it

flint hedge
#

Could you please show that in blueprint screenshot form? Its probably an ownership thing because the door starts in the level, but how would I assign ownership to the client?

#

in your compendium it looks like you are using an interface to open the door? I was just making a door blueprint that was self contained with a box trigger to turn off and on input (simple stuff) would I need to make an interface for this to work?

drowsy zodiac
#

@thin stratus sorry, i kinda merged two separate issues when I referenced you lol. Meant to tell you that I confirmed using server travel without steam works. The other issue I was talking aloud about is an engine bug with the anim graph.

#

Back to server travel, I cant seam to server travel from lobby, connected through steam

twin juniper
#

@drowsy zodiac If you're using two different game modes, make sure seamless travel is checked on both

#

IE one for lobby, one for gameplay

drowsy zodiac
#

@twin juniper ok, I shall give it a try. Ty

twin juniper
#

@lapis jetty We need more details to be able to help you. If you're doing it in blueprints then screenshots are great

drowsy zodiac
#

@lapis jetty if your attempting it in blueprints you wont be able to get far as you will have to tie into ue4's movement prediction using c++.

drowsy zodiac
#

@lapis jetty perhaps try using root motion from a roll animation. You'll need to play the animation as a dynamic montage for networking.

twin juniper
#

@drowsy zodiac If you inherit from Character then a lot of that is already taken care of

drowsy zodiac
#

@twin juniper well, I have never had any luck being able to launch a character over the network with 200 ms simulated lag smoothly

#

The ue4 prediction fights the client's pawn location

twin juniper
#

Launch character is physics based though right?

fierce birch
#

CMC has launch function if I remember right

#

and CMC does it's own physics math

twin juniper
#

CMC?

fierce birch
#

character movement component

twin juniper
#

Right

fierce birch
#

the thing where all the character stuff is really handled

#

including prediction and it's own builtin physics

drowsy zodiac
#

Well in general I have tried many ways of doing custom movement types with networking and blueprints and haven't had much luck beating the location presiction

#

Prediction*

#

I believe the correct way is to tie into the movement component's flag in cpp

#

Cant remember the variable name

wet oriole
#

I using 4.13.1

fossil spoke
#

Thats really weird, turn off PostProcess?

#

Looks like a Post rendering issue

wet oriole
#

I'll try it, when i move the player everything is ok

#

@fossil spoke

drowsy zodiac
#

I have had this issue before. Perhaps its an engine bug

#

Are you level streaming?

#

Ive had this issue in a single player game

wet oriole
#

No i don't use level streaming

red ledge
#

I was wondering, is there a way to display session results in UMG so that they update in real time? for example when someone new joins anyone who has the server list up can see that another player joined?

fossil spoke
#

You could just refresh constantly i guess. But the current exposed system to BPs doesnt support this. You would have to write it yourself i guess.

#

Since it returns an array of results and it takes time to query for servers it basically just comes in as an batch

red ledge
#

Yup, that's the problem, I show the c++ reults in a blueprint wrapper function but I was wondering if there is a way to keep them updated like on tick or timer without refreshing the whole serverthing because it take time

wary wyvern
#

Hey guys. Can someone explain, how can I replicate montage, wich I call with Play Animation? I need to sync the animation by the time character starts to replicate. For example server starts playing montage in 5th second for himself and others (multicast), but player has entered the game at second 8, so he ain't got any multicast events and character with animation just stand still.

spark igloo
#

Hey guys, I have a UE4 game and i planning to make it online multiplayer game and wont have much knowledge on this as this is my 1st online multiplayer game. So can any one help me out which service is best and easy to integrate with ue4 games? I heard about Playfab, GameSpark and steam.

compact oyster
#

I suggest going through blueprints first before digging into C++

#

@wary wyvern because the client who joined after the event has executed, never knows what has happened before he joined

spark igloo
#

@compact oyster hey thanks for those links. I am able to implement local Multiplayer using LAN but i am planning to make it online using services like steam or playfab. Which one will be easy to integrate and to implement into the project and any good resources or links so that i will go through it ๐Ÿ˜ƒ Thanks for the youtube link i will check that ๐Ÿ˜ƒ

compact oyster
#

Currently I'm using steam myself for a game, haven't tried the others out but steam seems to be reasonable to do with blueprints. Online would be no problem with steam aswell :p

wary wyvern
#

GuuhaN there is a problem.. Montage have some sections. And if I replicate it at begin play (with repnotify), it starts from beginng, but I need to start it at server's animation time.

#

Or at least at server's current section

compact oyster
#

so the server/host is keeping track of where on the timeline the animation is playing? and whenever someone joins, it starts playing the animation from where the server is at?

wary wyvern
#

It should work so, yes. I guess

red ledge
#

I asked before why IOnlineFriends::GetFriendsList doesn't return anything

if figured that it was because it only gets the stored friends list

first need to read it from the online subsystem using IOnlineFriends::ReadFriendsList and passing on a FOnReadFriendsListComplete delegate that is bound to a function that gets the friend list using IOnlineFriends::GetFriendsList

if anyone is interested

bronze lava
#

Hello, any suggestions on how I'd go about implementing a team system with blueprints? The gamemode spawns and possesses my players, but I can't make the gamemode do anything if pressing a button from client (select team) :/

#

So apparently as the gamemode is only present on the server, how would I make it so that when pressing a team select button the gamemode would spawn a player?

red ledge
#

I think all the team stuff should be in PlayerState which is replicated to all and you check the team on the GameMode when you try to spawn the player

#

it'll have some RPCs to be able to set the replicated teamindex variable on the PlayerState though

bronze lava
#

Thank you. My teamID (red/blue) is stored in the PlayerState. If you have any more ideas on how to properly do RPCs and get this to work, I'd love to hear them

bronze lava
#

I will, thanks.

vivid siren
#

Hey what's your best ideas on quickly distributing a game for testing multiplayer? I want a few friends and I to be able to test a game we're making from our own homes but the process right now is very slow

#

Currently, I have to build the game, zip it, upload to google drive, then they download and unzip, then we can play

#

Is there a quicker way of going about this? Would Dropbox or Github do the job or something like that?

brittle sinew
#

If your upload speed is the bottleneck, I might even look at Perforce, as it only sends the delta over the network @vivid siren

#

You might be able to make BTSync work however, as once you start distributing, your other friends can upload to other friends

#

I use BTSync every day for laptop/desktop file keeping, but not sure how it would work with UE4

vivid siren
#

These look interesting, but the hassle might not make it worth it

#

This won't be a long term thing for us, just a small thing for little projects we goof around on

brittle sinew
#

I would agree on Perforce, but BTSync is really simple to set up, and apparently it does support binary delta

#

You just add the folder, give your friends the key, and they'll instantly start downloading it

#

(actually apparently now it's called Resilio Sync D:)

vivid siren
#

Ooh okay, so whenever I rebuild the project, i just throw it in a specific folder and they will be able to download it right away?

brittle sinew
#

Yep, and if your upload speed isn't a bottleneck vs your friends', the P2P portion of it should help

vivid siren
#

would the individual version be enough for a ue4 game or would I need to use the workgroup version?

brittle sinew
#

If you're technically using it for business I think you're supposed to buy the workgroup... but the features of the free version should be fine, and if it's just friends you'll be good

vivid siren
#

perfect, yeah it's just for friends for us to mess around with, no commercial stuff or money involved

#

thanks!

brittle sinew
#

If it works well let me know, might end up using it for UE4 if something arises in the future ๐Ÿ˜„

#

But yeah, it's an amazing program just in general

loud sage
#

Would it be an ok mechanic to let users host servers for a f2p game? So when someone wants to join a game, they get put in a que and a random person gets selected to host once the que is big enough

#

If you use reporting etc, cheating should be a relatively minor issue (as if someone cheats, they get banned from hosting/banned from the game. And for people who host I could introduce rewards)

brittle sinew
#

I think that's really too opinionated of a question for there to be "an answer" to it, but thinking that cheating would be minor because people can report probably won't go well, especially if you're relying on that as your form of AC

#

Some big games go that route though, so it's definitely not unheard of

#

Especially in a F2P game though, banning won't do anything

loud sage
#

Hm

#

I am just trying to find a way to release a MP f2p game and not having the huge costs of servers ๐Ÿ˜›

brittle sinew
#

I get it, each way will always have their pros and cons, it's just up to you to weigh them ๐Ÿ˜›

loud sage
#

Hm

red ledge
#

even though I use EFriendsLists::InGamePlayers to only get in game friends, steam still gives me the full friend list, any idea why?

brittle sinew
#

Are you using EFriendsLists::Type::InGamePlayers? Or just what you sent

#

And where are you sending that enum in? I haven't done much with multiplayer, but I don't see where the function actually checks an enum @red ledge

red ledge
#

FriendsInterface->ReadFriendsList(LocalPlayer->GetControllerId(), EFriendsLists::ToString((EFriendsLists::InGamePlayers)), FriendListReadCompleteDelegate); =

#

this

brittle sinew
#

UE_LOG_ONLINE(Warning, TEXT("Only the default friends list is supported. ListName=%s"), *ListName);

#

๐Ÿ˜ฎ

#

Looks like that's kinda just a dummy parameter?

#

And it doesn't actually take that into account, it just goes based on default and logs if it's not

red ledge
#

is that in the docs or source code?

#

I Think it might be for other online subsystems then

brittle sinew
#

That's the code, look at FOnlineFriendsSteam::ReadFriendsList

red ledge
#

oh ok, thanks

twin juniper
#

hey

#

could someone please explain to me why i would want to use PlayerState

#

instead of just having the data for that player

#

on the character itself

#

like

#

whats the diff between GameState, PlayerState

#

im still trying to figure this out lmao

#

also, anything done in the game mode is replicated to clients automatically because it is on the server only? GameMode is server only

#

because i made a timer on the game mode and i want to know if that timer is going to be automatically replicated to clients or if i need to set it up? I set it up to constantly check every x number of seconds for a condition to be met. If the condition is met, it then does the next step.

brittle sinew
#

I would use the PlayerState if there's info about somebody in a game that doesn't correlate to the character they're currently possessing

twin juniper
#

ok so like

#

if i made a value of "int32 NumKills"

#

how would i use it

#

for example, when the player gets a kill, how would i increment it... how would i get the value as well? If I want to do a game where it finds the last player alive and gets his/her stats and displays them for everyone to see... how would i do that

#

thats literally the only two things i need to know

#

how to access/alter the variable, and how i would get it (would i iterate? is there some sort of PlayerState iterator?)

brittle sinew
#

There's a PS array in the GameState, and you can get the PlayerState from a pawn (and thus indirectly a PC if it's possessing something)

twin juniper
#

so

#

how do i get the game state

#

in the game mode?

#

is there like

#

GetGameState

#

hold up i think ive actually used that before

brittle sinew
#

Or the world, yes

twin juniper
#

OH

#

on the GameMode

#

there is a variable

#

called "GameState"

#

lol

brittle sinew
#

Yeah, and you can access it on the world if you're doing it from a client

twin juniper
#

oh so it has "PlayerArray" which is a TArray of APlayerStates

#

and i can just loop through that?

#

and cast it to my playerstate

brittle sinew
#

There you go ๐Ÿ˜›

twin juniper
#

so like

#

hold on

#

last thing

#

oh i did it already

#

PlayerStateClass = myclass.Class;

#

lol

#

i wanted to see if i set up the player state class

#

ok so like

#

other thing i wanted to know

#

do u think its smarter to do what i am doing? Have a timer to check every 5 seconds until there is 1 player left? Or should I set it up some other way

brittle sinew
#

I would run the check every time someone dies

#

No point to doing it on a timer, when it can only change on a death, and it would update if more than one death in 5s

twin juniper
#

hm

#

yeah

#

that makes sense

#

i agree

#

was thinking about doing some sort of event system

twin juniper
#

@brittle sinew hey do i have to have OnlineSubsystemNull and OnlineSubsystemSteam

#

both installed and enabled

#

or can i just have one?

brittle sinew
#

I think you can only have one...?

#

They're separate things

twin juniper
#

o i got it

#

lol

#

i just set it up to use the Null subsytem

#

in the editor

#

and steam in packaged builds

twin juniper
#

@brittle sinew hey where would i want to handle death btw? In PlayerState? or somewhere else? Like I have a health value but should i just make a if (health <= 0) {CheckIfWinner()} inside of the tick function?

#

lol

#

like where should i put that at

#

in my actor

#

or playerstate

#

or game state

#

or game mode lmao

#

im thinking playerstate, but tell me if im wrong

brittle sinew
#

I wouldn't put it in the PlayerState, I usually only use that for variable storage and their helper functions, not actual logic (though that's just me)

#

I would put the handling on the server itself, just make sure that's being called from a server location, so the server character does the checks

twin juniper
#

yea

#

good thing ive noticed though

#

anything u do in the GameMode

#

is replicated automatically

#

timers...etc

brittle sinew
#

What do you mean replicated automatically

twin juniper
#

so like

#

i setup a timer in the preinitializecomponents method

#

and it basically counts down until the game begins

#

the "RemainingTime" int32 i made

#

is the same on all clients

#

which is what i wanted

#

because if its 5 seconds on the server it should be 5 seconds on all clients

#

does that make any sense at all... lul

brittle sinew
#

Is that variable replicated? Just wondering, if it works it works either way ๐Ÿ˜„

twin juniper
#

uhm

#

nope

#

i think its simply becaue i have the variable

#

inside of game state

#

that its automatically replicated

#

GameState is on Clients & Server

#

GameMode is on Server

#

PlayerState is on Clients & Server

brittle sinew
#

Oh yeah, GameState is replicated out of the box

twin juniper
#

yep

#

so my question is

#

if I have an actor

#

get a reference to playerstate

#

and tell it to alter "PlayerHealth"

#

will that be automatically replicated as well?

#

or would i need to make a replicated function to set the value that is in player state

brittle sinew
#

Only the server can set replicated values (unless you've got some sort of proxy going on, which you don't here)

twin juniper
#

ok

#

so i would need to use a replicated function

#

to set the value thats in playerstate

brittle sinew
#

Yeah, but why would you be altering PlayerHealth from the client?

twin juniper
#

i dont know any other way

#

of doing it

#

lol

#

like if im being completely honest

#

lol

brittle sinew
#

Well, what does your calling flow look like right now?

twin juniper
#

for what

#

lol

brittle sinew
#

Altering the health

twin juniper
#

oh

#

right now its not doing it

#

i was going to have it be where

#

the player presses left click

#

it does a raycast

#

if it hits the player, it deducts health

#

i have the raycast setup it just doesnt do anything yet lol

brittle sinew
#

So, you should call a server function with the info about the player hit, then have the server change the player's health

#

Keep in mind that would allow the player to call a hit up to the server whenever they want, but when you're just beginning that's not a huge deal

#

Just know that's a thing

twin juniper
#

lol

#

yeah i know

#

but i just dont know what the alternative would be

#

you know the game Ark Survival?

#

I dont want my game to do that stupid shit where it moves you forward, then u get teleported back (because the server is correcting the lag..etc)

#

that type of rubberbanding will make people quit the game

brittle sinew
#

Well, that's just an artifact of the client being allowed to move on its own client-side, like the CharacterMovementComponent does out of the box

twin juniper
#

yeah

#

i dont like that

#

that problem

#

can get ur character killed

#

like if u keep moving forward and it doesnt render in changes

brittle sinew
#

That's true, but the alternative is not moving until you call up to the server, and it calls back

#

So it's all about finding the balance

twin juniper
#

idk i just feel like that is a massively gameplay intense thing

#

like... if your movement is broken

#

then how can u have a competitive atmosphere for a multiplayer game

brittle sinew
#

I'll be honest, you probably won't be getting competitive-level netcode without writing most of it on your own

twin juniper
#

i mean back in the day i worked in java and setup a server/client connection which could send primitives over a network

#

and ping back when it got a result or not

#

like it wasnt too hard lol

brittle sinew
#

Well let's say you're playing a game, and have like a 50ms ping, that wouldn't be unusual, and probably higher for a p2p game, you would have at least a 50ms delay on all movement actions

#

That would feel really bad

twin juniper
#

yeah

#

i agree

#

but having it teleport the player backwards in time

#

about 10 seconds

#

is absolutely ridiculous

brittle sinew
#

Well, that probably stems from the networking not being able to keep up with the world scale if I had a guess at it

#

But I'm not entirely sure

twin juniper
#

yeah

#

ark has some of the worst lag ive seen

#

u walk up to a storage box, press E and then it does nothing and u get teleportd back to the door to the building

#

its absolutely retarded

hollow bear
#

Does anyone know of a tool to send a message to a socket? I'm trying to test receiving a message on an actor component, but I can't figure out the software I'm using to do it. (I can send from UE4 and see them in the program "TCP/IP Builder")

I was wondering if there was something better to use.

past totem
#

I think thats what you are looking for?

hollow bear
#

Might be a bit too much for what I'm doing, but I should be able to glean what I need from it. Thanks.

#

Nope, he is using an UE4 server to do the chat on.

I'm looking at doing stuff strictly over TCP.

twin juniper
#

My question is, what is actually different from that custom function and just the regular options string?

wet oriole
#

Hello guys,
I've two different pawns in my multiplayer project for server and client, I want to know how i can run a function on the server pawn class when client join ? Thanks